Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about Android development and PDF

Merge two PDF into one new single page PDF

More
10 years 4 months ago #9810 by emilof
Since my last approach displaying two PDFs side-by-side (act as single page) isn't doable I have a new approach.

First merge the two singel paged PDFs into a new single page PDF where PDF #1 is positioned to the left and PDF #2 to the right. Then display it.

Is this doable using RadaeePDF?
More
10 years 4 months ago #9812 by Davide
Hi,
yes you can do it, but you need a Premium License.
You have to use ImportPage() method


I also suggest you to look at these threads:
- ww2.radaeepdf.com/forum/Android-developm...ortpage?limitstart=0
- www.radaeepdf.com/forum/Android-developm...g-false?limitstart=0
More
10 years 4 months ago #9818 by emilof
I tried to import one page from an existing PDF into a newly created one, but can't get it to work. ImportPage() returns false.

What are I doing wrong here?
Code:
Global.Init( this ); String srcPath = getFilesDir() + "/test.PDF"; String dstPath = getFilesDir() + "/out.pdf"; Document srcPdf = new Document(); Document dstPdf = new Document(); srcPdf.Open(srcPath, null); dstPdf.Create(dstPath); Document.ImportContext context = dstPdf.ImportStart(srcPdf); boolean success = dstPdf.ImportPage(context, 0, 0); context.Destroy(); dstPdf.Save(); dstPdf.Close(); srcPdf.Close();
More
10 years 4 months ago - 10 years 4 months ago #9820 by Davide
Hi,
you need a Premium License.

When you use ImportPage do not forget to invoke ImportContext.Destroy() after all pages are imported.

You can check in PDFTestAct the concat_pdf void as example of merging two PDF documents.
Last edit: 10 years 4 months ago by Davide.
More
10 years 4 months ago #9823 by emilof
I did my tests in your test project using the pre-defined license.

I have also verified that activePremium() returns true.

Is it possible to activate some kind of debug mode for the library so I can get more detailed information why ImportPage() returns false?
More
10 years 4 months ago #9825 by Davide
Hi,
no there is no debug mode.

Please check this method from PDFTestAct :
Code:
private void concat_pdf( String dst, String src ) { Document doc_dst = new Document(); Document doc_src = new Document(); doc_dst.Open(dst, null); doc_dst.SetCache(Global.tmp_path + "/ttt.dat"); doc_src.Open(src, null); ImportContext ctx = doc_dst.ImportStart(doc_src); int dstno = doc_dst.GetPageCount(); int srccnt = doc_src.GetPageCount(); int srcno = 0; while( srcno < srccnt ) { doc_dst.ImportPage(ctx, srcno, dstno); dstno++; srcno++; } ctx.Destroy(); doc_src.Close(); doc_dst.Save(); doc_dst.Close(); }
Time to create page: 0.466 seconds
Powered by Kunena Forum