#1 2013-04-22 12:36:52

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Advice for the use of PDF Engine

I need of advice to understand if I can use your PDF Engine on my project.
In my project I use an external library to extract PDF page as image (with 200/300 dpi).
Now I need convert a PDF to PDF/A-1. I know your library cannot read a PDF but it can write a PDF/A-1, so I think I can extract all page of my PDF as bitmap then use your library to generate a PDF/A-1 with an image for page.

Questions:
1. Is it possible with your PDF Engine?
2. My image are big (200/300 dpi) but the PDF page are simple: text, tables and some small image so I cannot need of a perfect copy of it. Is there a way to reduce the PDF/A-1 size?
3. Do you think this is a good (not best) solution? I have PDF with 5/20 pages, the PDF/A-1 will take many time?

regards

Offline

#2 2013-04-22 13:44:36

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: Advice for the use of PDF Engine

If you have the source as bitmaps, you can:

1. Create a new PDF/A-1 with a bitmap on each page;
2. Reduce the bitmap size before printing on each PDF page;
3. It will be very fast to process. I guess most time will be when retrieving the input PDF pages as bitmaps.

Offline

#3 2013-05-16 09:32:41

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Advice for the use of PDF Engine

Thank you for your reply.
I have write a small piece of code but I have a problem because I don't understand how can I handle the image resolution.
I have extract 2 bitmap from my PDF: 1 bitmap from A4 page with 300 dpi and 1 bitmap from A3 page with 300 dpi;
Now I need create a PDF/A-1 with 2 pages (A4 + A3) but I cannot lost information about resolution. How can I set the page?
This is a piace of my code:

      dpi := 300;
      lPdf.DefaultPaperSize := psUserDefined;
      lPdf.PDFA1 := True;
      lPdf.ScreenLogPixels:=dpi;
      lPage := lPDF.AddPage;
      lPage.PageWidth := Round(dpi * 210 / 25.4);
      lPage.PageHeight := Round(dpi * 297 / 25.4);

If I use dpi=72 (screen resolution) I get a PDF with A4 page (21cm x 29,7 cm) but if I set dpi=300 I get a big page.
I don't understand how cannot lost the resolution of my origin image.

Offline

#4 2013-05-16 13:04:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: Advice for the use of PDF Engine

Why not use DefaultPageWidth/Height befoer lPDF.AddPage call?

Offline

#5 2013-05-16 13:49:02

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Advice for the use of PDF Engine

Because in my example I have used an A4 pages but general I don't know the page size until extract the image from my original PDF (no PDF/A-1), so I need use 2 variables to set Width and Height.
Something like:

      dpi := 300;
      lPdf.DefaultPaperSize := psUserDefined;
      lPdf.PDFA1 := True;
      lPdf.ScreenLogPixels:=dpi;
      lPage := lPDF.AddPage;
      lPage.PageWidth := Round(dpi * pWidth / 25.4);
      lPage.PageHeight := Round(dpi * pHeight / 25.4);

Any idea?

Offline

#6 2013-05-16 14:30:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: Advice for the use of PDF Engine

You can still set the DefaultPageWidth/Height values BEFORE calling AddPage.

Offline

#7 2013-05-16 14:42:51

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Advice for the use of PDF Engine

If I set DefaultPageWidth/Heigh I get the same result.

      dpi := 300;
      lPdf.DefaultPageWidth := Round(dpi * 210 / 25.4);
      lPdf.DefaultPageHeight := Round(dpi * 297 / 25.4);
      lPdf.DefaultPaperSize := psUserDefined;
      lPdf.PDFA1 := True;
      lPdf.ScreenLogPixels:=dpi;
      lPage := lPDF.AddPage;
      lPage.PageWidth := Round(dpi * 210 / 25.4);
      lPage.PageHeight := Round(dpi * 297 / 25.4);

Offline

#8 2013-05-16 14:59:03

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,237
Website

Re: Advice for the use of PDF Engine

Those lPage.pagewidht := ... and lpage.pageheight := are to be removed!

Offline

#9 2013-05-16 15:33:02

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Advice for the use of PDF Engine

Yes, I know, I have try to comment them but I get always a big page: about 87 cm x 123 cm...

Offline

#10 2013-05-17 12:32:41

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Advice for the use of PDF Engine

Is there a way to do this:
1. create a PDF with many pages;
2. the pages can have differente size (ex. A4, A3 or custom size);
3. the pdf must have high resolution (ex. 300 dpi), because I must stamp big bitmap on page.

Offline

Board footer

Powered by FluxBB