Print Page | Close Window

Wrong image positioning?

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3290
Printed Date: 22 Nov 24 at 6:24PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Wrong image positioning?
Posted By: OloLiuqui
Subject: Wrong image positioning?
Date Posted: 24 Mar 16 at 2:50PM
Hi
I'm using Debenu Quick PDF Library 11.14. 
I have a Delphi code that injects a raster image to PDF page. It works as expected on most PDFs, but one PDF causes an issue. Here is the code:
---
  PDF := CoPDFLibrary.Create;
  PDF.LoadFromFile('d:\TestDocs\EasyRecovery622 User Guide_EN.pdf', '');
  PDF.SelectPage(1);
  Height := PDF.PageHeight;
  Width := PDF.PageWidth;
  PDF.AddImageFromFile('d:\TestDocs\test.png', 0);
  ImgHeight := PDF.ImageHeight;
  ImgWidth := PDF.ImageWidth;
  PDF.DrawImage(10, Height - 10, ImgWidth, ImgHeight);
  PDF.SaveToFile('d:\TestDocs\embedded.pdf');
---
I expect that the image will be embedded at the left top corner of the page and will be fully visible. With the attached PDF I can see only a small part of the image after saving the target 'embedded.pdf' doc. Is it a bug of the library or something is wrong with my source 'EasyRecovery622 User Guide_EN.pdf' doc?

Here is the problem PDF and sample PNG image:
https://drive.google.com/file/d/0B0r9WqjL12gOZzJYRTdHeDJmSDQ/view?usp=sharing

Thank you in advance.



Replies:
Posted By: Ingo
Date Posted: 24 Mar 16 at 3:31PM
Hi Olo,

if you wanna tell QuickPDF where to draw an image
you should tell where the starting point should be.
With SetOrigin you can do this:
http://www.debenu.com/docs/pdf_library_reference/SetOrigin.php
An additional thing you should have an eye on is that sometimes
pdf-pages are made in portrait mode and later rotated to landscape.
So a NormalizePage first should be always good:
http://www.debenu.com/docs/pdf_library_reference/NormalizePage.php

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo



Posted By: OloLiuqui
Date Posted: 24 Mar 16 at 5:54PM
Hi Ingo,

Normalization worked like a charm! Thanks a lot.

Best regards,
Olo



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk