Is there any API in C# or .net to edit pdf documents? [closed]

*爱你&永不变心* 提交于 2019-11-28 07:36:51

问题


Is there any API in C# or .net to edit pdf documents?

Like I need to retrieve particular text and replace it with my own text.

Thanks
nRk


回答1:


This is not possible (in a clean & reliable way), from iTextSharp tutorial:

You can't 'parse' an existing PDF file using iText, you can only 'read' it page per page. What does this mean? The pdf format is just a canvas where text and graphics are placed without any structure information. As such there aren't any 'iText-objects' in a PDF file. In each page there will probably be a number of 'Strings', but you can't reconstruct a phrase or a paragraph using these strings. [...] You can't edit an existing PDF document, by saying: for instance replace the word Louagie by Lowagie. To achieve this, you would have to know the exact location of the word Louagie, paint a white rectangle over it and paint the word Lowagie on this white rectangle. Please avoid this kind of 'patch' work. Do your PDF editing with an Adobe product.




回答2:


there are a number of 3rd party libraries (such as Aspose(paid tool)), but there's not really a native API.

That said, PDF is an open-standard so you can get how the file is structured and parse it on your own.



来源:https://stackoverflow.com/questions/1781208/is-there-any-api-in-c-sharp-or-net-to-edit-pdf-documents

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!