Corrupted PDF attachment on SOST tcode - abap

I am sending email using cl_bcs class as PDF attachment.Now, when I do issue output to in VA02/03 tcode,it works and in email I can open the attachment.But,on press of save in change mode in va02 tcode,as output type is automatically triggered using condition record,it sends the mail but the PDF attachment(which is adobe form only) shows corrupted.
Any pointers?

Thanks for all your help.I found out the solution. The reason was that the pdf from Adobe Form FM was not generating correctly.So before converting to Binary, we need to pass docparams-getpdf = X.This solved the issue and attachment is opening like charm.I am using cl_bcs class for mail functionality.

Related

Mailitem.PrintOut() to PDF

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.

Using a GoogleSpreadsheet to fill in a PDF form

I have a very specific question and I would be extremely happy if anybody has any guess on how to solve it. I have: 1.- a PDF form which I have not created myself. 2.- a GoogleSpreadsheet created by myself.
Now the question is: is there any way I can fill in the PDF form using the information in the GoogleSpreadsheet, taking into account that this process should be activated from the GoogleSpreadsheet (since the PDF form is not mine)?
Best regards and thanks so much for everyone's input!
It depends.
You would need edit access to the PDF form, in order to get the field names. With that information, you could create a FDF (Forms Data Format, a PDF-related file format for data, using PDF syntax) file from the Google spreadsheet, which does refer to the PDF form as a base PDF. You then could open that FDF from the spreadsheet, and it should, if your webbrowser supports the Acrobat browser plug-in, grab the base PDF and populate it.
If you can not get the opening from the spreadsheet to work, download the FDF file and open it in Acrobat/Reader, or open the base form in Acrobat/Reader and import the data from the FDF file.

Save Livecycle PDF file before submitting to server

I have created a LiveCycle PDF form that includes a Submit button to send it as XDP (including the base64 encoded PDF) to a server that pulls out the XML data and saves that to a database and then pulls out the encoded stream, decodes it and saves that back as a PDF on the server.
The issue that I am having is that once I open the PDFs made from the base64 encoded data, it seems that they are empty. After some testing I found that if I manually save the PDF before Submitting it, the information that was entered up to when it was saved is included in the encoded PDF (whereas the full data is included in the XML portion).
So my question is there a way to either:
Automatically save the PDF or otherwise preserve the data so it is sent in the base64 encoded portion of the XDP? (preferable)
Recognize when a change in the document has changed and request that the user save the PDF before clicking submit?
It seems the issue I described above was actually due to using Foxit reader instead of Adobe reader.
Adobe reader of course requires the Reader Extensions in order to be able to save form data and submit it.
Foxit does not have that restriction but does not embed the updated version of the PDF in the XDP XML data sent to the server. The only way to perform this would be ensure the user saves the PDF first which removes the Reader Extensions as per Adobe's licensing requirements.

Submitting a PDF file and saving in ColdFusion

I need users to be able to fill out a form in a PDF file using their browser then, when they click the submit button in the PDF file's form, a new PDF file is saved with the contents they entered in the form.
One of the main examples I have been referencing is Adobe's help section on this subject, but have had no luck: http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec11c2b-7ffa.html
The PDF file I was provided didn't have a submit action associated with it. So, I opened up LiveCycle designer and found the submit button and added this code to it:
<submit format="pdf" target="http://localhost:8500/pdfforms/pdfreceiver.cfm" textEncoding="UTF-16" xdpContent="pdf datasets xfdf"/>
Changing the target to the correct location on my local server, of course. Then, when I use this portion of code:
<cfpdfform source="#PDF.content#" action="read" result="fields"/>
<cfdump var="#fields#">
I get an error saying:
Element CONTENT is undefined in PDF.
I also tried opening it up in Adobe Acrobat X Pro and setting the action to submit the entire PDF file, but that didn't work either. I'm using ColdFusion 9 on Windows 7 if that helps any. Thanks in advance for your help!
You don't use CFPDFFORM to read the results from submitting a PDF. The PDF form should do a FORM POST to the target page, just like an html web form.
You can see the results of the form by doing a CFDUMP on the FORM scope:
<cfdump var="#form#">
Then you use a variety of methods to parse through and store that information in a database.

Saving the modified contents of a pdf

I've got a form that I downloaded, I'd like to prefill some content on the form (this is easy using cfpdfform).
Where it gets tricky is I would like to allow the user to modify the contents of that form, and then somehow have those modified contents accessible to me. I didnt build the source PDF so I dont know how to allow the user to "save" the new contents so they can be read.
Any ideas on where I might start on this one?
You can also use the cfpdfform tag to read/write data to a PDF file which has a form. The important thing is that the PDF document already have the form fields available, or that you add them.
I just recently completed a task where I had to have a user fill out a normal web form, and then create a filled version of an existing PDF document. It worked like a breeze!
I think that depending on what you are trying to accomplish, having the user fill out the data in a web form is less confusing than serving up a PDF and expecting them to save that to update a file on a remote server. Just my opinion, though.
http://www.cfquickdocs.com/cf8/?getDoc=cfpdfform#cfpdfform
It's possible for users to complete most PDF forms in Adobe Reader, but when user's try to save the changes they get a popup prompting them that the PDF cannot be saved and would need to upgrade to Adobe Acrobat to have this functionality.
Since Acrobat 7 (or possibly) 8 it's possible to create a form so that it can be completed and saved in reader. In Acrobat open your PDF, and select Advanced -> Enable usage right in reader from the menu. This will prompt you to save the form and then anyone using Adobe reader can complete it.
Once that's done you can open the form in ColdFusion, populate some of the fields and serve it up to the user. Once they fill it in, save it and get it back in ColdFusion you can read the contents using the PDF related tags.
Please note: It's currently not possible to set the "enable usage rights in reader" flag from ColdFusion, you need a copy of Adobe Acrobat or access to Adobe LifeCycle server to do this.
This document may help you:
http://www.adobe.com/education/instruction/teach/coldfusion/CF8-2_advanced_cf8_development_unit8.pdf