Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
RenderPageToFile problem with an image |
Post Reply |
Author | |
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
Posted: 21 Apr 20 at 10:09PM |
Hi :)
now i'm "on the other side" - hoping there's somebody out there to help ;-) I have invoices made by HP Exstream, PDF version 1.3, no encryption. On each page there's a coloured logo in the top area. If i render a page with 72 dpi to jpg the logo remains in the top area of the created image. If i render the same page with 100 dpi to jpg the logo is in the bottom area of the created image. If i render the same page with 150 dpi to jpg the logo is in the middle of the created image. With 300 dpi the logo is between middle and top... I can't separate or extract this logo as an image nor i can separate it on a single layer. First i've thought: No problem... CombineContentStreams and NormalizePage will fix it. But both functions are without any effects :( After LoadFromFile i'm doing: If QP.EncryptionStatus > 0 Then QP.Decrypt; QP.SetOrigin(1); // oben, links QP.CombineContentStreams; QP.NormalizePage(0); I'm using QuickPDF 17.11 with Delphi XE5. My project is compiled as 32 bit. I can't publish the relevant invoices cause they are from a customer. Edited by Ingo - 21 Apr 20 at 10:11PM |
|
Cheers,
Ingo |
|
tfrost
Senior Member Joined: 06 Sep 10 Location: UK Status: Offline Points: 437 |
Post Options
Thanks(0)
|
Have you tried a different renderer, or PDFIUM? What happens if you try converting it to image in some other PDF utility, just for comparison purposes - do they also get it wrong?
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi,
i've changed the code to RenderPageToStream but with no success. I'll try using PDFium... |
|
Cheers,
Ingo |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi,
Now i've linked to PDFium. I've downloaded the dll from github. The dll is in my app-path. Variable selren shows me a 4 - so PDFium is selected. If i set 72 as dpi the resulting image is 9 kb but it's completely blank/white. If i set 200 as dpi the resulting image is 61 kb but it's completely blank/white. QP := TDebenuPDFLibrary1711.Create; try okay := QP.LoadFromFile(FName, ''); QP.SetPDFiumFileName('pdfium.dll'); selren := QP.SelectRenderer(4); // ShowMessage(IntToStr(selren)); If QP.EncryptionStatus > 0 Then QP.Decrypt; QP.CombineContentStreams; QP.NormalizePage(0); Try result := QP.RenderDocumentToFile(dpi, 1, 1, 1, Pchar(target)); // ShowMessage(IntToStr(QP.LastErrorCode) + ' / ' + IntToStr(result)); Finally End; finally if (QP.PageCount > 0) then QP.Free; end; |
|
Cheers,
Ingo |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
If i'm doing only a preview on an image component then it works fine and the graphical elements from the invoice are always on the right position and it doesn't matter which zoom factor (dpi) i'm using:
procedure TForm11.SpeedButton1Click(Sender: TObject); var ms : TMemoryStream; jpg : TJPEGImage; test_stream : TMemoryStream; begin if ( zoom < 300 ) then zoom := zoom + 10; QP := TDebenuPDFLibrary1211.Create; try QP.LoadFromFile(Edit1.text, ''); If ( QP.EncryptionStatus > 0 ) Then QP.Decrypt; QP.CombineContentStreams; test_stream := TMemoryStream.Create; QP.RenderPageToStream(zoom,page,1,test_stream); finally QP.Free; end; try test_stream.Seek(0,0); jpg := TJPEGImage.Create; jpg.LoadFromStream (test_stream); Form11.Image1.Picture.Assign(jpg); finally test_stream.Free; jpg.Free; end; end; |
|
Cheers,
Ingo |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
a sample gives me a rendered jpg-file with 134 kb and a blank page.
If i resave it with IrfanView then i've a jpg with only 51 kb (i think better compression with only white pixels). So i think in the initial blank image there is something unvisible? |
|
Cheers,
Ingo |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
The main prob with the confused image objects after rendering with a new dpi value still exists.
The blank page while rendering via PDFium to an imagefile with QP 17.11 is solved while using the old version 14.11 ;-) |
|
Cheers,
Ingo |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store