PDF Generating Tool Support Forum

HOME   Login   Register    Search




  Subject: body background-color vs. background-image
   PostPosted: 24 Aug 2010, 20:15 
I´ve got an PDF, where I´d like to give a full Image as Background. I tried many ways, but I couldn´t find a suitable solution. So I decited, to split the Image up in 3 parts. one for the header, one for the "flowing" and one for the footer. It seems pretty nice so far, but when I try to put the "flowing" image in the body, I got an white space by about 1cm. If I remove the image and take only a color, the white space is gone!

Any suggestions?


  Subject: Re: body background-color vs. background-image
   PostPosted: 25 Aug 2010, 10:22 
You may define a page background this way:

PD4PageMark footer = new PD4PageMark();  
footer.setPageBackgroundImageUrl("http://server/img/background.jpeg"); 
pd4ml.setPageFooter(footer);


It will stretch the image to cover the choosen paper format, so it makes sense to prepare a background image whose aspect ratio is identical to the format.


  Subject: Re: body background-color vs. background-image
   PostPosted: 25 Aug 2010, 12:24 
I´d like to thank you, for the quick answer. It works perfect. :-)
Code:
public class Pd4Php {

  private String image_url;
   public static void main(String[] args) throws Exception {
...
      Pd4Php converter = new Pd4Php();
      converter.generatePDF( args[0], args[1], args[2], args[3], args.length > 4 ? args[4] : null );
// give an additional argument to the command line
   }
private void generatePDF(String inputUrl, String htmlWidth, String pageFormat, String fontsDir, String imageUrl)
{ // an additional String imageUrl
if(imageUrl != null)
    {
      PD4PageMark footer = new PD4PageMark();
      footer.setPageBackgroundImageUrl(imageUrl);
      pd4ml.setPageFooter(footer);
    }
}

In your PHP Code you need to add the following:
Code:

passthru('java -Xmx512m -Djava.awt.headless=true -cp .:pd4ml_demo.jar Pd4Php \'' . $_POST['url'] .
            '\' 800 A4 $_POST['image_url'] 2>&1');



[Reply]     [ 3 posts ] 

Copyright ©2004-10 zefer|org. All rights reserved. Bookmark and Share