Print Page | Close Window

Add Image to existing PDF

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=3343
Printed Date: 13 May 25 at 9:10AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Add Image to existing PDF
Posted By: fmenditto
Subject: Add Image to existing PDF
Date Posted: 15 Jun 16 at 11:40AM
I try to add an image to existing pdf file with simple code (vb.net): 
        QP.LoadFromFile("test.pdf", "")
        QP.SelectPage(1)
        Dim id As Integer = QP.AddImageFromFile("test_image.png", 0)
        Dim lWidth As Integer = QP.ImageWidth()
        Dim lHeight As Integer = QP.ImageHeight()
        QP.DrawImage(0, 450, lWidth, lHeight)
        QP.SaveToFile("test_updated.pdf")

But in the result PDFI can't see the image. If I create e new pdf and I add image I can see it.
there is sometihng bad ? 

Thanks 




Replies:
Posted By: rweetch
Date Posted: 15 Jun 16 at 7:14PM
does the PDF have mutlple streams? If so it could be drawing to a stream which is hidden by content on a higher stream.


Posted By: Ingo
Date Posted: 15 Jun 16 at 9:54PM
Hi fmenditto,

i'm missing a SelectImage - Add is not enough.
Try this one (if it's not tiff) and it will work (Delphi):
             image := QP.AddImageFromFile(fstring, 0);
             QP.SelectImage(image);
             QP.SetPageDimensions(QP.ImageWidth,QP.ImageHeight);
             QP.DrawImage(0,0,QP.ImageWidth,QP.ImageHeight);

A NormalizePage could be always good before ;-)

Cheers and welcome here,
Ingo



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




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