Imagen FPDF bajo diseño

I import a PDF file with 2 pages using fpdi, it works.

I need to insert an image in my imported pdf but its in under the original pdf layout so I cant see the image that i want to insert. By the way, I can add text and it works properly.

I do the same thing in the second page of my pdf and it works, i can see the image (jpg and png). In my 2nd page of my original pdf I dont have any layout/image coming from the original imported pdf.

I need a z-index property like in css/html

FUENTE: http://pastebin.com/45BEY7fw

preguntado el 08 de noviembre de 11 a las 12:11

2 Respuestas

Prueba esto: http://forums.devshed.com/php-development-5/fpdf-background-image-510220.html

Since you are importing data from a PDF file I don't know how it handles it. Are you getting elements as text or image? I guess that you are trying to get an image-converted PDF (you're reading an image, like a snapshot of the page, and not text items) over an image on the background. I guess that this won't work if the original PDF conversion was made with JPG.

Let me know if that's happening.

Respondido 25 Feb 13, 02:02

My imported pdf have a background image in the page 1, not in page 2. So i can see my inserted image in the second page and not in the first page. Source added - ocho

Yep, like I said. I guess you are trying to put a watermark under that page, right? You create your PDF document. Add the background image and then when you open your PDF, the 1st page's background is loaded over the first image. The background image of the PDF file you are importing had been converted to JPEG, for instance, wich covers the first one you had on the new document. Can you place the background image of the 1st page before the one you're trying to add on the new document? This would place the 'test.png' over the initial background. Can you test it and give me a notice? - Mário Rodrigues

También encontré esto: staff.dasdeck.de/valentin/fpdf/fpdf_alpha which seems to add FPDF lib the ability to handle the image's alpha channels. - Mário Rodrigues

I want to add an image over all my imported pdf.I dont create a pdf, I import it. I think the original pdf was made in Corel Draw - ocho

Did you ever get round this? I'm in the same scenario, imported images are behind my content. - Ben

If you print on the page before importing template page - it works . here is my code :

  $pdf - > AddPage();

  //draw watermark
  $pdf - > SetTextColor(215, 215, 215);
  $pdf - > SetFont('Times', '', 90);
  $pdf - > RotatedText(24.5, 234.5, $school_data['watermark'], 45);
  $pdf - > SetTextColor(0, 0, 0);

  //load template
  pdf - > setSourceFile('reports/template.pdf');
  $tplIdx = $pdf - > importPage(1);
  $pdf - > SetAutoPagebreak(false, 0);

  //use the imported page and place it at point 0,0; calculate width and height
  //automaticallay and ajust the page size to the size of the imported page
  $pdf - > useTemplate($tplIdx, 0, 0, 0, 0, false);

respondido 09 nov., 14:22

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.