Code error to place watermark

Asked

Viewed 210 times

-2

Error mark water in pdf exists in this code ?

index document.php

   <?php
    session_start();
    ?>

<!DOCTYPE html>
<html lang="pt-br">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>teste</title>
    </head>
    <body>
        <h1>Cadastrar documento pdf com marca-d'água</h1>

        <form method="POST" action="marcarpdf.php" enctype="multipart/form-data">
            <label>Titulo do Artigo: </label>
            <input type="text" name="titulo_artigo"><br><br>

            <label>pdf </label>
            <input type="file" name="imagem"><br><br>

            <input type="submit" value="Cadastrar"><br><br>
        </form>

    </body>
</html>

marcarpdf.php

<?php
require_once('pdfwatermarker/pdfwatermarker.php');
require_once('pdfwatermarker/pdfwatermark.php');

//Specify path to image. The image must have a 96 DPI resolution.
$watermark = new PDFWatermark('myimage.png'); 

//Set the position
$watermark->setPosition('bottomleft');

//Place watermark behind original PDF content. Default behavior places it over the content.
$watermark->setAsBackground();

//Specify the path to the existing pdf, the path to the new pdf file, and the watermark object
$watermarker = new PDFWatermarker('C:\test.pdf','C:\output.pdf',$watermark); 

//Set page range. Use 1-based index.
$watermarker->setPageRange(1,5);

//Save the new PDF to its specified location
$watermarker->savePdf(); 
?>

this code giving error however in php believe that missing some code in php someone could show me where I can make the changes ?

  • 1

    What error do you accuse?

  • 1

    Not Found can be seen in my test http://brazilianmodel.com.br/

1 answer

1

The error is on your system’s redirect page from action of <form>:

inserir a descrição da imagem aqui

Should have the php at the end, according to the name of the document.

    <form method="POST" action="marcarpdf." enctype="multipart/form-data">
        <label>Titulo do Artigo: </label>
        <input type="text" name="titulo_artigo"><br><br>

        <label>pdf </label>
        <input type="file" name="imagem"><br><br>

        <input type="submit" value="Cadastrar"><br><br>
    </form>

Change to:

<form method="POST" action="marcarpdf.php" enctype="multipart/form-data">

Browser other questions tagged

You are not signed in. Login or sign up in order to post.