THPDFPage.Width

THPDFPage

 

Atas  Sebelumnya  Berikutnya

Menentukan ukuran horizontal halaman

 

Sintaks Delphi:

property Width: integer;

 

Sintaks C++:

__property int Width;

 

Deskripsi

Gunakan properti Width untuk membaca atau mengubah lebar halaman. Untuk kertas standar, gambar, kartu, format ID/paspor, dan foto, pilih nilai enum THPDFPage.Size yang telah ditentukan sebelumnya seperti A2, A3, B2, B4, A5, B5, Tabloid, Ledger, ANSIC, ARCHD, dan P8R. Nama psXXX yang sudah ada tetap menjadi alias yang kompatibel. Gunakan Width dan Height bersama UserDefined hanya ketika dimensi yang dibutuhkan belum ditentukan sebelumnya

Tabloid berukuran 11 x 17 inci. Ledger adalah ukuran landscape 17 x 11 inci; jangan perlakukan Ledger sebagai nama lain untuk Tabloid portrait.

Nama enum ukuran foto memakai awalan P saat spesifikasi aslinya diawali angka. Misalnya, P5R mewakili ukuran foto 5R yang terlihat oleh pengguna.

 

Contoh kode

program CustomPageSize;
{$APPTYPE CONSOLE}
uses
  SysUtils,
  HPDFDoc;

var
   HPDF: THotPDF;

begin
    HPDF:= THotPDF.Create(  nil  );
    try
        HPDF.AutoLaunch := true;                // PDF file will be shown automatically
        HPDF.FileName := 'CustomPageSize.pdf';  // Set PDF filename
        HPDF.PageLayout := plOneColumn;  // Set one column viewer mode

        HPDF.BeginDoc;                              // Create PDF file

        HPDF.CurrentPage.Size := UserDefined;
        HPDF.CurrentPage.Width := 1024 / 25.4 * 72;   // 1024 mm in PDF points
        HPDF.CurrentPage.Height := 768 / 25.4 * 72;   // 768 mm in PDF points
        HPDF.CurrentPage.TextOut(10, 10, 0, '1024 x 768 mm custom page');

        HPDF.EndDoc;                                                       // Close PDF file
    finally
        HPDF.Free;
    end;
end.

 

Lihat juga Height, Size