PdfPage - Scoped, Global

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 5분
  • Creates a PdfPage object representing a PDF page and its attributes; such as size, width, and color.

    This API is part of the ServiceNow PDF Generation Utilities plugin (com.snc.apppdfgenerator) and is provided within the sn_pdfgeneratorutils namespace. The plugin is activated by default.

    This API is a component used with the Document API to generate a PDF.

    PdfPage - PdfPage(String pageSize, String orientation)

    Instantiates a new PdfPage object.

    표 1. Parameters
    Name Type Description
    pageSize String PDF page size.
    Valid values:
    • A4 – 595 x 842 points
    • EXECUTIVE – 522 x 756 points
    • LETTER – 612 x 792 points
    • LEDGER – 792 x 1224 points
    orientation String Optional. PDF page orientation.
    Valid values:
    • LANDSCAPE
    • PORTRAIT

    Default: PORTRAIT

    The following example shows how to create a PdfPage object.

    var pdfpage = new sn_pdfgeneratorutils.PdfPage("A4", "LANDSCAPE");

    PdfPage – getBottom()

    Gets the Y-coordinate of the lower edge of a PDF page.

    표 2. Parameters
    Name Type Description
    None
    표 3. Returns
    Type Description
    Number Decimal value of the Y-coordinate at the lower edge of the PDF page.

    The following example shows how to get the Y-coordinate of the lower edge of a PDF page.

    var pdfpage = new sn_pdfgeneratorutils.PdfPage("A4", "LANDSCAPE");
     var bottom = pdfpage.getBottom();

    PdfPage – getLeft()

    Gets the X-coordinate of the left edge of a PDF page.

    표 4. Parameters
    Name Type Description
    None
    표 5. Returns
    Type Description
    Number Decimal value of the X-coordinate on the left edge of the page.

    The following example shows how to get the X-coordinate of the left edge of a PDF page.

    var pdfpage = new sn_pdfgeneratorutils.PdfPage("A4", "LANDSCAPE");
     var left = pdfpage.getLeft();

    PdfPage – getPdfPageSize()

    Gets the size of a PDF page

    표 6. Parameters
    Name Type Description
    None
    표 7. Returns
    Type Description
    None

    The following example shows how to get the PDF page size.

    var pdfpage = new sn_pdfgeneratorutils.PdfPage("A4", "LANDSCAPE");
    var size = pdfpage.getPdfPageSize();

    PdfPage – getRight()

    Gets the X-coordinate of the right edge of a PDF page.

    표 8. Parameters
    Name Type Description
    None
    표 9. Returns
    Type Description
    Number Decimal value of the X-coordinate on the right edge of the page.

    The following example shows how to get the X-coordinate of the right edge of a PDF page.

    var pdfpage = new sn_pdfgeneratorutils.PdfPage("A4", "LANDSCAPE");
     var right = pdfpage.getRight();

    PdfPage – getTop()

    Gets the Y-coordinate of the upper edge of a PDF page.

    표 10. Parameters
    Name Type Description
    None
    표 11. Returns
    Type Description
    Number Decimal value of the Y-coordinate at the upper edge of the PDF page.

    The following example shows how to get the Y-coordinate of the upper edge of a PDF page.

    var pdfpage = new sn_pdfgeneratorutils.PdfPage("A4", "LANDSCAPE");
     var top  = pdfpage.getTop();

    PdfPage – getWidth()

    Gets the width of a PDF page.

    표 12. Parameters
    Name Type Description
    None
    표 13. Returns
    Type Description
    Number Size of the page width in points.

    The following example shows how to retrieve the width of a PDF page.

    var pdfpage = new sn_pdfgeneratorutils.PdfPage("A4", "LANDSCAPE");
    var width = PdfPage.getWidth();