Print Page | Close Window

Add image to PDF File with "DAOpenFile"

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: General Discussion
Forum Description: Discussion board for Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=4012
Printed Date: 22 Nov 24 at 1:16PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Add image to PDF File with "DAOpenFile"
Posted By: Amelie
Subject: Add image to PDF File with "DAOpenFile"
Date Posted: 02 Jun 23 at 7:10PM
hi,

Delphi : I access a PDF file with "DAOpenFile" . I want to add an image to this PDF file then save it with another name with "DASaveAsFile". I wrote the following code but it creates a PDF file with an empty page with the image.
Here is my code:

var
  QuickPDF: TDebenuPDFLibrary;
  FileHandle  : Integer;
begin
try
  QuickPDF := TDebenuPDFLibrary.Create ;
  QuickPDF.UnlockKey(edtLicenseKey.Text)    ;
 FileHandle := QuickPDF.DAOpenFile('D:\MyPDF_file.pdf', '');

 QuickPDF.AddImageFromFile('D:\Myimage.png',2);

 QuickPDF.DrawImage(380, 200, 120, 120);

QuickPDF.DASaveAsFile( FileHandle , 'D:\PDF_With_image.pdf' );

  finally
    QuickPDF.Free;
  end;

//---------------------

how to do please?
thanks



Replies:
Posted By: Ingo
Date Posted: 02 Jun 23 at 9:23PM
Hi Amelie :) 

Don't mix ... NEVER mix DA-functions with non-DA-functions - This won't work.
Take the normal open- and the normal save-function and it will work as expected.

Cheers,
Ingo



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



Posted By: Amelie
Date Posted: 03 Jun 23 at 7:39AM
Hi Ingo, 
thank you for help.

 I have a big file of 600mb, when I open it with ''LoadFromFile'', my application consumes a lot of resources, but, if I open this file with 'DAOpenFile', there is no consumption of resources.
 - if I use 'DAOpenFile' + 'SaveToFile', the application creates an empty page with the image. 
- if I use 'LoadFromFile' + 'SaveToFile', it's ok, but a lot of memory consumption. 
How to solve this problem please?
 THANKS


Posted By: Ingo
Date Posted: 08 Jun 23 at 9:36PM
There's nothing to solve ;-)
Don't mix DA- with non-DA-functions.
Try the "normal" functions and do a complete refresh after the call.



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



Posted By: tfrost
Date Posted: 09 Jun 23 at 2:28PM
Provided that your program does not crash on 'out of memory', there should be no problem with using the 'non-DA' functions, other that it being slower to process your very large file.  If the other parts of your program give it a very big memory requirement, and the process memory exceeds 2GB, then you can try increasing this by adding {$SETPEFLAGS IMAGE_FILE_LARGE_ADDRESS_AWARE} immediately above the 'begin' in your Delphi DPR file. Or of course you could also build it as a 64-bit process, which might also speed it up a little.



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