Skip to Content

How do I print Attchment document via ABSL Code?

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Nov 16, 2016 at 09:10 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 16, 2016 at 07:56 AM

    Hi Sankaran,

    Have you debugged your codes and checked the value in PDF variable?

    Is there any error message?

    Best Regards,

    Fred

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • Nov 16, 2016 at 09:29 AM

    Hi Sankaram,

    Just to be sure, you need to call "Save after execution" in your event handler.

    Best Regards,

    Fred

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 02, 2017 at 09:36 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 04, 2017 at 05:05 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded