Print Page | Close Window

Problems adding images to a 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=3756
Printed Date: 25 Apr 24 at 8:41AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problems adding images to a PDF
Posted By: penrose
Subject: Problems adding images to a PDF
Date Posted: 29 Oct 19 at 2:37PM
I bought this library a few days ago.
I'm new to using this library.

I am using the function to add a image file to a PDF file.


The source code is as follows:

   
        Dim fileName As String = "c:\source.pdf"
        Dim OutputFile As String = "c:\qpdf.pdf"

        Dim docID As Integer = QP.LoadFromFile(fileName, "")
     
        Dim tempimage As Integer 
        tempimage = QP.AddImageFromFile("c:\x.jpg", 0)

        QP.SelectPage(1)

        QP.SetOrigin(1)
        QP.SelectImage(tempimage )
        
        QP.DrawImage(0, 0, 100, 100)
  
        QP.SaveToFile(OutputFile)
     
        QP.RemoveDocument(docID)


No problem with pdf files created with adobe acrobat.

However, using Microsoft's print to pdf feature, the position and shape of the image may not be accurate.

The image is reversed and added to the wrong place


You can download a pdf file that doesn't work with the code above.

http://oum.kr/source.pdf

I would like to know how to add an image without converting this pdf file to pdf using acrobat again.

I love this library, thank you!



Replies:
Posted By: tfrost
Date Posted: 29 Oct 19 at 5:45PM
I would suggest trying to call NormalizePage after you have selected the page and before you draw on it.


Posted By: penrose
Date Posted: 30 Oct 19 at 1:55AM
It WORKS! Thank you!!!


Posted By: Ingo
Date Posted: 31 Oct 19 at 3:29PM
...and i think a CombineContentStreams should help,too ;-)

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