GdPicture.NET.14
GdPicture14 Namespace / GdPictureDocumentConverter Class / TxtPageWidth Property
Example





In This Topic
TxtPageWidth Property (GdPictureDocumentConverter)
In This Topic
Specifies the page width, in points, of the resulting document when converting from the source txt file. The default value is 595, which is the A4 document width.
Syntax
'Declaration
 
Public Property TxtPageWidth As Single
public float TxtPageWidth {get; set;}
public read-write property TxtPageWidth: Single; 
public function get,set TxtPageWidth : float
public: __property float get_TxtPageWidth();
public: __property void set_TxtPageWidth( 
   float value
);
public:
property float TxtPageWidth {
   float get();
   void set (    float value);
}

Property Value

The default value is 595.
Example
Converting a text file to a PDF document specifying custom properties for the layout of the resulting document.
using (GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter())
{
    // Set the text and document properties to be used for the resulting file.
    gdpictureDocumentConverter.TxtFontFamily = "Times New Roman";
    gdpictureDocumentConverter.TxtFontSize = 16;
    gdpictureDocumentConverter.TxtFontBold = true;
    gdpictureDocumentConverter.TxtFontItalic = false;
    gdpictureDocumentConverter.TxtHorizontalTextAlignment = TextAlignment.TextAlignmentCenter;
    gdpictureDocumentConverter.TxtPageHeight = 842; // A3 page size
    gdpictureDocumentConverter.TxtPageWidth = 1191;  // A3 page size
    gdpictureDocumentConverter.TxtPageMarginTop = 20;
    gdpictureDocumentConverter.TxtPageMarginBottom = 20;
    gdpictureDocumentConverter.TxtPageMarginLeft = 20;
    gdpictureDocumentConverter.TxtPageMarginRight = 20;
            
    using (Stream inputStream = File.Open("input.txt", System.IO.FileMode.Open))
    {
        using (Stream outputStream = File.Create("output.pdf"))
        {
            gdpictureDocumentConverter.ConvertToPDF(inputStream, GdPicture14.DocumentFormat.DocumentFormatTXT, outputStream, PdfConformance.PDF1_5);
        }
    }
}
See Also