I want to edit the PDF text layer programatically through the Open Office PDF Import Extension.
I know it is possible to edit the PDF file through OPEN OFFICE PDF file extension from the Open Office UI.
Is there any API available for .Net of PDF Import Extension to do it programmatically?
Is there a particular reason for using OpenOffice.org for this? You can manipulate pdf files in the way you want using iTextSharp
Related
It is working on the same tab though.
Terms of Use
It is working for the file types .html and .txt but not for .pdf even .docx files get downloaded.
I am writing this code in cshtml.
I want to open a pdf document in a new tab.
I have some ole file with ole2 format in legacy system.
These are office word or excel & with embed object (e.g. picture) I think.
If I rename the file with docx or xlsx externsion, it will say file is corrupted.
Could I extract the ole file with some existing C# library? And save it as word or excel document?
OLEFileStructure PNG
NOTE:
The OlePres\d\d\d stream are embed ole object I think.
The Ole stream says it's a embed file not link.
The compObj stream indicate it's file type. e.g. Microsoft Word Document
For package type ole file, I have follow below blog to extract the file from ole10native stream successfully -- https://eigenein.wordpress.com/2011/08/03/how-to-extract-ole-attachment-body-from-ole10native-stream/
Updates: (Possible solution)
For old style, e.g. xls, doc, it could just rename the ole file to those extension and it works. But some of the file cannot be opened via MS Office, but it open successfully via Libre Office.
For new style, e.g. xlsx, docx. It could extract the Package stream and save as xlsx or docx. file.
For old style, e.g. xls, doc, it could just rename the ole file to those extension and it works.
But some of the file cannot be opened via MS Office, but it open successfully via Libre Office. So I use the Libre office command line tool to convert it with same format, e.g. soffice --convert-to docx *.docx --outdir ../Converted
Then it could be opened via MS Office.
For new style, e.g. xlsx, docx. It could extract the Package stream and save as xlsx or docx. file.
In my C# application i have a help button. When it's pressed I would like for the application to open up a PDF file in the systems default PDF reader, something I can do with a command like Process.Start("pathToPDF").
The problem is that I would like to include the PDF as a resource instead of calling an external file. I do not wish to copy the PDF to the users computer and do not want to host it online or on a NAS.
Right click on your project in the Solution Explorer, then add existing file and choose your pdf (if you cannot find it, make sure you are showing all files and not just .cs files etc.).
Click on the newly added item once in the solution explorer and in the properties window, you set Copy to Output Directory to Copy Always or Copy if newer.
Now you can open the pdf file as expected using Process.Start(filename.pdf);
The only Secure way to show a PDF without providing a file is to include your own Viewer Component (Ex. http://www.o2sol.com/pdfview4net/overview.htm)
Some components allow to load a PDF from Memory (as in a embedded Resource) directly into your Viewer Component, another way would be to create an encrypted binary file to ship with your application and encrypt/load when necessary.
As soon you want to show the PDF in an external viewer ,be aware that the User will have the ability to save the PDF anyway.
Maybe you can explain your reasons to not want to include the file, so we can suggest other solutions to you?
Update:
As noted in your comment, the goal is to have a clean installation.
It would be possible to embed the File as a resource, but then you would
have the problem that if you extract the file temporarily to display it, you can't really control the clean-up of that file, because it's locked by the PDF Reader Application.
So you would end up with the PDF File anyway ;)
What you can do to keep your Application Folder cleaner, is to not install the PDF under that Application Folder but under the "Common Documents" Directory.
For Example: Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments), "MySoftware", "Help.pdf")
Which normally targets: C:\Users\Public\Documents\MySoftware\Help.pdf
I am strugling with Open XML SDK and embedding pdf files into a docx file.
I do not want to use automation
I am able to create *.bin files from everything except from *.pdf (see this question)
Anyone has experience with this? From what I've gathered you must create a *.bin file in order to embedd any file into Word *.docx document (except images). Is that correct?
If you can't find a pure C# solution, you could consider the commercial product docx4j OLE Helper IKVM'd.
Disclosure: I wrote it.
The reason for pdf not working was in fact in acrobat reader.
When Ive installed older version (or did not have AR installed at all), it started to work.
has anyone tried to insert pdf document into word using open xml sdk 2.0 ?
Thank You!
With the SDK there is a tool called DocumentReflector (in folder C:\Program Files\Open XML Format SDK\V2.0\tools). This tool opens an existing OpenXML document and generates the code that will produce this document.
Now you can create a simple document in Word with an embedded PDF and open this document using DocumentReflector. The code generated can then be a base for your document creation process.