ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 CreatePDFFile Not Opening Document

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
PaulF Posted - Sep 05 2024 : 05:51:43
Hi,
I'm having a bit of trouble creating a blank PDF document and adding pages using PDF Viewer. I get an exception document is not open. See source code below. Am I not using it correctly? Is there is a work around that would be great.
thanks very much.
regards
Paul


    { Load source image into IEView. }
    IEViewSrc := TImageEnView.Create( PnlLft );
    IEViewSrc.Parent := PnlLft;
    IEViewSrc.Align := TAlign.alClient;
    IEViewSrc.IO.LoadFromFile( FileOpenDlg.FileName );

    { Create doc generator IEView, create the PDF doc and add the loaded image as a page. }
    IEViewDocGen := TImageEnView.Create( PnlRht );
    IEViewDocGen.Parent := PnlRht;
    IEViewDocGen.Align := TAlign.alClient;
    IEViewDocGen.PdfViewer.Enabled := True;
    IEViewDocGen.IO.CreatePDFFile( 'D:\Projects\FOCUS\Media\Test\GenTestDoc.PDF' );
    IEViewDocGen.PdfViewer.AddPage( IEViewSrc.IEBitMap, TIOPDFPaperSize.iepA4, TIEPageLayout.ielPortrait, -1, 0, True, True );
    IEViewDocGen.IO.SaveToPDF;



5   L A T E S T    R E P L I E S    (Newest First)
PaulF Posted - Sep 09 2024 : 04:53:29
Thanks Nigel - Just the job.
Paul
xequte Posted - Sep 07 2024 : 00:39:58
Hi Paul

You can create a new document within PdfViewer using:

ImageEnView1.PdfViewer.Document.NewDocument();

And new pages using:

http://www.imageen.com/help/TIEPdfViewer.AddPage.html


Nigel
Xequte Software
www.imageen.com
PaulF Posted - Sep 06 2024 : 02:16:50
Thanks for your replies. Thought that might be the case.
As a workaround I've used PDFBuilder to create a single page blank document, then after loading into PDFViewer, I've used PdfViewer.ImportPages to import pages from another PDF doc and also PdfViewer.AddPage to add screenshot images. Finally I've deleted the blank page. So all good.

That said I did have an issue with PdfViewer.AddPage trying to add a TIEPageLayout.ielLandscape TIOPDFPaperSize.iepA4 page kept coming out as portrait. Need to do a bit more testing.

kind regards
Paul

xequte Posted - Sep 05 2024 : 16:20:18
Hi

Unfortunately you are using two different methods here:
- PDFViewer (built on PDFium)
- IO.SaveToPDF (TIEPDFBuilder: native PDF saving).

They should not be used together.

Is your intention to create a multi-page PDF built on images only?

If so, try the TIEPDFBuilder demos:

PDF\PDFBuilder\PDFBuilder.dpr
PDF\PDFBuilder2\PDFBuilder2.dpr


If you want some level of interactive editing, then a solution built on PDFViewer might be better.

Sorry, that is confusing. See the notes regarding PDF at:

https://www.imageen.com/help/File_Formats.html#PDF


Nigel
Xequte Software
www.imageen.com
aleatprog Posted - Sep 05 2024 : 12:14:28
Hi Paul,

did you valuated using TIEPDFBuilder to create PDF documents from scratch?

https://www.imageen.com/help/TIEPDFBuilder.html

Ale