Can you share simple Program for sending attached PDF document via FAX using JobSubmit service.

Can you share simple Program for sending attached PDF document via FAX using JobSubmit service. Without CSV file.

Comments

  • Hi @Prabhakr_2018 ,

    I'm looking for a sample implementation for Java. I have a code but it doesn't attach a jpeg/tiff document to the fax using JobSubmit Service. There's no DocumentType in the job submit service so I'm using the code below instead. I tried using setting DocumentSet in the request but it doesn't work. On another option, I also tried setting the document in the ContentPartType but I'm getting errors with the treatment, pulltypeoptions and addrtypeuse.

    Below is the code that I used:

          DocDataType data =

              new DocDataType();

          data.setFormat(DocEncodingFormat.base64);

          data.set_value("This is a test.");

          DocumentType doc =

              new DocumentType();

          doc.setDocType("JPEG");

          doc.setDocData(data);

          doc.setRef("test");

           doc.setFilename(new EncodableStringType());

          doc.getFilename().set_value("C:\\Users\\Administrator\\Downloads\\eyes.jpeg"); //D:\\test.txt");

          DocumentType[] docArr = {doc};

          req.setDocumentSet(docArr);

          // Message(s)

          MessageType msg =

              new MessageType();


          ContentsType contents =

              new ContentsType();

          ContentPartType part =

              new ContentPartType();

           

    //      AddressType[] addressType = {AddressType.fax};

          part.setTreatment(TreatmentType.attachment);

    //      part.setAddrTypeUse(addressType);

    //      part.setPullfileOptions(new PullfileOptionsType());

           

          part.setDocRef("test");

    //      part.setDocument(doc);

          System.out.println("getDocument:::: "+part.getDocument());

          ContentPartType[] partArr = {part};

          contents.setPart(partArr);

          msg.setContents(contents);


    Can you please advise on how to proceed? Thanks.

  • mparvathi_2021
    mparvathi_2021 Moderator, E Community Moderator

    Hi Angief,

    If you want to attach PDF or JPEG or any type of acceptable formats by Jobsubmit API then you need to encode it to base64 and you set encoded value in DocData element as shown below:


    DocDataType data =new DocDataType();

         data.setFormat(DocEncodingFormat.base64);

         data.set_value("/9j/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsKCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQk4fD3wCv8O1k9QRlbUSshija6RjS5rLBrRmJyl1nBJLGNkkkksYSSSSxhJJJLGEkkksYSSSSxhJJJLGEkkksYSSSSxj//2Q==");

         DocumentType doc =new DocumentType();

        doc.setDocType("JPEG");

         doc.setDocData(data);

         doc.setRef("test");

         doc.setFilename(new EncodableStringType());

         doc.getFilename().set_value("test.jpeg");

  • angief
    edited May 6, 2021 #5

    Thanks for your reply.

    In our cover page, we have "Notes" and we assigned it in data.set_value with a text value but in your example above., you assigned it with a base64 data. where can I assign the notes value now as shown in our cover page below: Is there anywhere else in the API where I can assign a text value to Notes?

    used

  • I already got it working by declaring another DocDataType and DocumentType and assigned the text value for the notes there.

    I can see that its now displayed correctly with the attachment in the next page.

    Thanks anyway.