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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Copy images from pdf file to another pdf file
  FAQ FAQ  Forum Search   Register Register  Login Login

Copy images from pdf file to another pdf file

 Post Reply Post Reply
Author
Message Reverse Sort Order
emgi View Drop Down
Beginner
Beginner


Joined: 21 Aug 12
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote emgi Quote  Post ReplyReply Direct Link To This Post Topic: Copy images from pdf file to another pdf file
    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


Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store