使用pdfium在数组中获取PDF图像进行编辑
我正在尝试写下一种方法,以从fpdf_document
对象中获取所有PDF图像,以便在它们上执行操作,然后返回fpdf_document
,并更换图像。
应该是这样的:
- 对于输入
fpdf_document document
对每个(获取图像对象)的每个(获取图像对象) - 对每个做事。
- 将原始对象替换回
fpdf_document
- 返回
fpdf_document
这很有意义吗?
由于没有文档,我迷失了我的pdfium源。指针将不胜感激。谢谢
I am trying to write down a method to get all PDF images from a FPDF_DOCUMENT
object to perform actions on them and return back theFPDF_DOCUMENT
with the images replaced.
It should be like this:
- For each (get image objects) for input
FPDF_DOCUMENT document
- DO something to each.
- Replace the original objects back to the
FPDF_DOCUMENT
- Return the
FPDF_DOCUMENT
Does that make sense?
I am lost in PDFium source as there are no documentation. Pointers would be much appreciated. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将必须使用以下方法/步骤:
fpdf_loaddocument
或等效的fpdf_getPageCount
在文档上fpdf_loadpage
每个页面都有fpdfpage_countobjects
获取对象的数量fpdfpage_getObject
在每个对象上fpdfpageObj_getType
在每个加载对象上fpdf_pageobj_image
,然后继续,else skipfpdfimageObj_getBitMap
/fpdfimageobj_setbitmap
?)fpdfpage_generatecontent
以确保使用更改更新内部页面fpdf_closepage
关闭页面fpdf_saveascopy
保存新的PDFfpdf_closedocument
以关闭原始文档。You would have to use the following methods/steps:
FPDF_LoadDocument
or equivalentFPDF_GetPageCount
on the document to get the amount of pagesFPDF_LoadPage
for every page there isFPDFPage_CountObjects
to get the amount of objectsFPDFPage_GetObject
on every objectFPDFPageObj_GetType
on every loaded objectFPDF_PAGEOBJ_IMAGE
, then continue, else skipFPDFImageObj_GetBitmap
/FPDFImageObj_SetBitmap
?)FPDFPage_GenerateContent
to make sure the internal page is updated with the changesFPDF_ClosePage
to close the pageFPDF_SaveAsCopy
to save the new PDFFPDF_CloseDocument
to close the original document.