on 11-16-2016 6:48 AM
Hi Experts,
I configured the automatic printing (Cloud Print Manager) with my tenant. I need to print the attachment document. I'm using the bellow code. But It is not working. Am I missing anything?
var Useraccountid : UserAccountID;
var PDF : basisGlobal:BinaryObject;
PDF.Clear();
PDF.content = this.AttachmentFolder.Document.GetFirst().FileContent.BinaryObject.content;
PDF.fileName = "FileName";
PDF.mimeCode = this.AttachmentFolder.Document.GetFirst().FileContent.BinaryObject.mimeCode;
Useraccountid.Clear();
Useraccountid.content = "PRT_001";
var testPrint = OutputManagementUtilities.CreatePrintQueueItem(Useraccountid, PDF.fileName, 1, PDF, "CustomForm");
Regards
Sankaran A
Hi Sankara,
You cannot send empty PDF to the print queue.
Only write these and test.
var Useraccountid : UserAccountID;
var PDF : basisGlobal:BinaryObject;
PDF.content = this.AttachmentFolder.Document.GetFirst().FileContent.BinaryObject.content;
Useraccountid.content = "PRT_001";
var testPrint = OutputManagementUtilities.CreatePrintQueueItem(Useraccountid, "test1", 1, PDF, "CustomForm");
Best Regards,
Fred
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm also having one more doubt Fred,
I debugged the code. I got 89504E470D0A1A0A0000000D49484452000001DC0000.... this is the PDF Content value.
I checked in Backend. (Repository Explorer). The Content is :iVBORw0KGgoAAAANSUhEUgAAAdwAAACrCAYAAADM8y04AAAACXBIW.....
Is there any problem on this value mismatch?
Regards
Sankaran A
Hi Sankaran,
Thank you for your quick reply.
The below logic i tried but i did'nt get image in byd screen.
import ABSL;
import BASIS.Global;
import DocumentServices.Global;
//var image.fileName = "FileName";
//var document = this.Im_AttachmentFolder.Document.GetFirst().FileContent.BinaryObject.mimeCode;
var documentlist = this.Im_AttachmentFolder.DocumentList.Where(n=>n.Name=="logo1.jpg");
var doc = documentlist.GetFirst();
if(doc.IsSet()){
//this.IM_BO = doc.FileContent.BinaryObject; doc.AlternativeName ="logo1.jpg"; doc.CategoryCode = "2";
doc.TypeCode.content = "10013";
doc.MIMECode = "image/jpg";
}
Thanks,
Kreddy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sankaran,
for pdf it is good. my requirement is get image from attachmentfolder.
can you just tell me the logic for image.
Thanks,
Kreddy.
,Hi Sankaran,
For pdf it is good. my requirement is get image from attachment folder.
For image can you just tell me the logic.
Thanks,
Kreddy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kotesware,
I'm also facing the same problem. I will analysis the issue.
My Assumption is: In this scenario, SAP Printer Software trying to convert image file into PDF file. So the file get Corrupted. So it is not printing proper data.
I don't know whether my point is correct or not. I am keep on trying to get an answer.
In mean time, If you get an answer please update here.
Regards
Sankaran A
Hi,
I have created separate question.
https://answers.sap.com/questions/95036/how-to-print-image-from-attachment-folder.html
If you get an idea/solution, Please update your answer there.
Regards
Sankaran A
Hi Sankaram,
Just to be sure, you need to call "Save after execution" in your event handler.
Best Regards,
Fred
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sankaran,
I think the method does not return anything.
Have you checked the print queue "CustomForm"?
Best Regards,
Fred
Thank you so much, Fred.
It is working now. I did mistake in Print queue name. My Print Queue Name is "CustomFormTest".
Regards
Sankaran A
Hi Sankaran,
Have you debugged your codes and checked the value in PDF variable?
Is there any error message?
Best Regards,
Fred
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi F red,
I debugged the code. But I didn't get any error.
var testPrint = OutputManagementUtilities.CreatePrintQueueItem(Useraccountid, PDF.fileName,1, PDF,"CustomForm");
But the above line, the content of the PDF value will be empty.
PDF.content = this.AttachmentFolder.Document.GetFirst().FileContent.BinaryObject.content;
In the above line, the content will be set as byte array value.
Regards
Sankaran A
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.