PDF Tool - Covert image to PDF- the image size is not resized and right part is chopped off

A Score Level 1

 {

{
  'type!{urn:appian:ps:pdftools}PdfContent'(
    page: 1,
    xPercent: 10,
    yPercent: 95,
    angle: 0,
    sections: {
      'type!{urn:appian:ps:pdftools}PdfSection'(
        components: 'type!{urn:appian:ps:pdftools}PdfImage'(
          scale: .2,
          document: todocument(ri!imageCreated)
        )
      ),
    }
  ),
  'type!{urn:appian:ps:pdftools}PdfContent'(
    page: 1,
    xPercent: 50,
    yPercent: 10,
    angle: 0,
    sections: {
      'type!{urn:appian:ps:pdftools}PdfSection'(
        style: 'type!{urn:appian:ps:pdftools}PdfStyle'(
          fontSize: 9
        ),
        components: {
          'type!{urn:appian:ps:pdftools}PdfText'(
            value: concat(
              ri!Nm,
              ", FEI#",
              ri!Id,
            )
          ),
        }
      ),
      'type!{urn:appian:ps:pdftools}PdfSection'(
        style: null,
        components: {
          'type!{urn:appian:ps:pdftools}PdfText'(
            value: concat(
              a!forEach(
                items: index(ri!Dates,"date",null),
                expression: if(
                  fv!isLast,
                  fv!item,
                  fv!item & ", "
                )
              ),
              " ",
              ri!teamInitials,
            )
          ),
        }
      ),
      'type!{urn:appian:ps:pdftools}PdfSection'(
        style: null,
        components: {
          'type!{urn:appian:ps:pdftools}PdfText'(
            value: concat(
              if(
                a!isNullOrEmpty(ri!Number),
                {},
                { "Exhibit ", ri!Number, " - " }
              ),
              "Page ",
              ri!imageCounts,
              " of ",
              ri!pageCount
            )
          ),
        }
      ),
    }
  ),
}

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    I don't know that this smart service promises any sort of pre-scaling of images that will be added to PDFs (and, maybe it does and you need to continue tweaking the parameters you pass to find the "right fit").

    Otherwise I'd suggest you check out the "resize image" functionality in the Appian Image Utilities plug-in, to handle out-size images prior to PDF conversion.  I struggled for a while to figure out how to tell an image's size programmatically, but eventually I stumbled on the "Get File Metadata" plug-in which makes it possible.

Reply
  • 0
    Certified Lead Developer

    I don't know that this smart service promises any sort of pre-scaling of images that will be added to PDFs (and, maybe it does and you need to continue tweaking the parameters you pass to find the "right fit").

    Otherwise I'd suggest you check out the "resize image" functionality in the Appian Image Utilities plug-in, to handle out-size images prior to PDF conversion.  I struggled for a while to figure out how to tell an image's size programmatically, but eventually I stumbled on the "Get File Metadata" plug-in which makes it possible.

Children