I want to printout a complete email to pdf. the standard printer is selected as microsoft Print to PDF. Running the printout method, a saveas window occures and I dont know, how to handle that programatically.
I still know the way to convert via a word object, but that does not work, as screenshots will not be printed and the header is missing. So, this is not an answer for me: Save complete email, body and header, as PDF
Can anybody tell me how to deal with the saveas dialog and the filename of the resulting pdf?
One possibility would be to print the mail to an xps file (print to file - how to do that). After that, I could convert xps to pdf using PDFSharp.
Regards and thanks,
Jan
The Word editor can be used for saving the message body as a PDF file.
Word.Document doc = mailItem.GetInspector.WordEditor;
doc.SaveAs2(fullPath, FileFormat: Word.WdSaveFormat.wdFormatPDF);
Note, you need to add a COM reference to the Word object model to your project before using its object model in the code.
Related
I am looking for the method (of Word ole-object) which can open pdf in the Microsoft Word.
I want to copy all pages of pdf into doc/docx and add there footers.
Could anybody give the cue how to import pdf?
PS: any sample code for this problem would be great.
Thanks,
Lilya
You need OCR (Optical Character Recognition) engine for converting PDF to document. PDF is generic format and it can include text as image. So it is very hard to convert PDF to document. SAP hasn't got any OCR function for doing this. Maybe OpenText (if customer using it) has this functionality, I haven't got detail information about opentext. You need third party tools for this. You can use online services or command line utilities to converting PDF files to text files easelly if PDF included text, otherwise you need professional SDKs (for example Abbyy Finereader) for doing this.
I used FoxIT PDF Reader to save the PDF file into text file and make a macro to read the text file. Of course, by doing so, you can only get the text, but nothing else.
I am trying to print Form using PrintForm in VB.Net
This Form has few labels and a chart control.
I have used this very simple code
Dim pf As New PrintForm
pf.Form = Me
pf.PrintAction = PrintAction.PrintToFile
pf.PrintFileName = "../../generated_pdf.pdf"
pf.Print()
It generated "generated_pdf.pdf" file. When I am trying to open this file it gives me an error
Couldn’t open PDF
Something’s keeping this PDF from opening.
Any ideas on how to resolve this error and successfully generate a working pdf that can be opened and viewed with it's right contents?
The form that should be converted to pdf looks like this
PrintForm does not know how to handle PDF files, which is why its not working.
It only knows how to do .eps, .ps & .ai.
If you want PDF, you'll need something that knows how to turn one of the above formats into a PDF.
Ghostscript & Ghostscript.Net do this nicely and are free & open source. There are others, but I've actually used these and know they work.
I am trying to print a section of an existing pdf to a new pdf. The original is searchable and selectable but the new pdf cannot do either. I am using "adobe acrobat reader DC" and print via "Microsoft Print to PDF". Unsure if there is any other relevant information.
After searching for a period of time I could not find an answer that allows for direct PDF to PDF print.
I did find a workaround however.
I downloaded a free software called PrimoPDF. Once installed, PrimoPDF becomes a printer option within Adobe acrobat reader. I then selected my desired pages and printed to PrimoPDf instead of Microsoft Print to PDF. This Generated a .ps file. I then imported the .ps file into PrimoPDF application and was able to generate a .pdf from that. The newly generated pdf was searchable and selectable and exactly what I needed.
Hopefully someone else finds this useful in the future.
Generally refrying (printing to PostScript then converting back to PDF) is a bad idea. The reason that Microsoft Print to PDF created a file that wasn't searchable is because when Adobe Reader detects that the printer it is targeting isn't capable of rendering the PDF correctly because of any number of reasons, like it doesn't have the right fonts for example, it will render the PDF itself and send an image to the printer. A simpler PDF probably would have worked just fine.
You are much better off getting a tool that will simply allow you to extract the pages you need to a new file rather than printing.
I have a Microsoft word document with 58 pages when I generate pdf file with word itself or doPDF or other softwares, they generate pdf file with 61 pages. How can I solve this problem.
My document written in Persian language.
Word loves to reformat the document whenever something is changed in the printer settings (such as selecting another printer). You might make sure that you have the printer driver used for doPDF active when you edit the document, and invoke the Print command.
You may also make sure that the page sizes selected in the print dialog correspond to the one of the document.
You can also, make sure that you have written the document using word's ability to end (break pages) that way you will make sure that the pages you have are not moving, especially the figures.
I'm converting WORD docs to PDF programmatically using vb.net and ghostscript. This word doc I’m having problems with has hyperlinks to external URLs and also hyperlinks to bookmarks within the document. When the doc is converted to PDF the external URLs work but the links to the bookmarks do not.
I have searched for a solution to get these bookmarks to work on the output PDF but haven’t had any luck. Hopefully someone has done this and can share the solution.
Ghostscript only handles PDF or PostScript as an input, there are sibling products to handle XPS and PCL as well but none of them handle Word .doc files. So you must be converting the Word file into something else.
I'll hazard a guess that you are using the Windows PostScript printer driver to convert to PostScript and passing that to GS (possibly via the RedMon Port Monitor) to convert into PDF.
Now PostScript doesn't support hyperlinks, bookmarks, or any of the other paraphernalia of a viewing application, since its intended as a print language. To overcome this Adobe introduced an extension, the pdfmark operator, which can be used to create this kind of information. NOTE this is an extension which is only supported for conversion to PDF.
So, in order to get these inserted, you need to create pdfmarks in the PostScript. If you are printing from Word, this means that you have to insert PostScript into the file when printing. There is a 'pass through' mechanism for this purpose.
So what you need to do is create the appropriate Visual Basic script in Word which inserts the relevant pdfmarks when the document is printed. This is how the Adobe plug-in for Word (which used to be called PDFMaker a long time ago) works.
Have a look at this tool.
It does maintain bookmarks and hyperlinks.
http://www.transcom.de/transcom/en/2004_pdf-t-maker.htm