Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
Copy images from pdf file to another pdf file |
Post Reply |
Author | |
emgi
Beginner Joined: 21 Aug 12 Status: Offline Points: 10 |
Post Options
Thanks(0)
Posted: 17 May 17 at 9:11PM |
I would like to copy the images from one file to another. To do this, I use DPLGetImageListItemDataToString and DPLAddImageFromString
But DPLAddImageFromString returns systematically 0 regardless of the image
What is wrong? int docid = DPLLoadFromFileA(pdflib, "file.pdf",""); int res = DPLSelectPage(pdflib, page); int ilid = DPLGetPageImageList(pdflib, 0); int imageCount = DPLGetImageListCount(pdflib, ilid); int ndocid = DPLNewDocument(pdflib); for (int i = 0; i < imageCount; i++) { DPLSelectDocument(pdflib, docid); DPLSelectPage(pdflib, page); char *tmp = DPLGetImageListItemDataToString(pdflib, ilid, i + 1, 0); double left = DPLGetImageListItemDblProperty(pdflib, ilid, i + 1, 501); double top = DPLGetImageListItemDblProperty(pdflib, ilid, i + 1, 502); double width = DPLGetImageListItemDblProperty(pdflib, ilid, i + 1, 503) - DPLGetImageListItemDblProperty(pdflib, ilid, i + 1, 501); double height = DPLGetImageListItemDblProperty(pdflib, ilid, i + 1, 502) - DPLGetImageListItemDblProperty(pdflib, ilid, i + 1, 508); DPLSelectDocument(pdflib, ndocid); DPLSelectPage(pdflib, 1); int imageId = DPLAddImageFromString(pdflib, tmp, 0); DPLSelectImage(pdflib, imageId); int res = DPLDrawImage(pdflib, left, top, width, height); } DPLCompressContent(pdflib); DPLSaveToFileA(pdflib,"D:\\file2.pdf"); ... Regards |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store