Can't get PDF-Writer.NET v2.7 from dbAutoTrack working...

Last post 07-03-2009 10:39 AM by kschuelke. 0 replies.

Sort Posts:

  • Can't get PDF-Writer.NET v2.7 from dbAutoTrack working...

    07-03-2009, 10:39 AM
    • Member
      1 point Member
    • kschuelke
    • Member since 05-20-2009, 8:11 PM
    • Posts 17

    and I can't find much info or help.  I'm just trying to get one of their simple samples to run on my local PC, once that's working I'll move it to my host and see if it will run under their setting of 'Medium Trust'.  But, I can't get it working on my local PC.  I get no errors, and I know it's executing as I follow it through debug, but when it gets to the _document.Generate(FileStream) command, it executes that command without throwing an exception, but no PDF is generated.  Here's my code, which is a copy of their sample:

    using

    System;

    using

    System.Linq;

    using

    System.Web;

    using

    System.Collections;

    using

    System.Collections.Generic;

    using

    System.Linq;

    using

    dbAutoTrack.PDFWriter;

    using

    dbAutoTrack.PDFWriter.Element;

    using

    dbAutoTrack.PDFWriter.Fonts;

    using

    dbAutoTrack.PDFWriter.Form;

    using

    dbAutoTrack.PDFWriter.Graphics;

    //using System.Web.UI;

    using

    System.Web.UI.WebControls;

    using

    System.Diagnostics;

    using

    System.IO;

    using

    System.Web.Security;

    using

    System.Configuration;

    using

    System.Web.UI.WebControls.WebParts;

    using

    System.Web.UI.HtmlControls;

    using

    System.Drawing;

    using

    System.Text;

    public

    class PDFWriterClass

    {

     

    {

     

    public void PDFWriterSample()//Initialize PDF Document

     

    _document.Title =

    _document.Author =

    _document.Creator =

     

    Document _document = new Document();"Welcome - PDF Sample";"dbAutoTrack Ltd, USA";"dbAutoTrack.PDFWriter";//Compression is set to true by default.

     

    //_document.Compress = false;

     

    //Initialize new page with PageSize A4

     

     

    Page page1 = new Page(PageSize.A4);//Get the PDFGraphics object for drawing to the page.

     

     

    PDFGraphics graphics1 = page1.Graphics;//using System.Drawing.Font;

    System.Drawing.

    System.Drawing.

    System.Drawing.

     

     

     

     

    Font _font1 = new Font("Arial", 10, FontStyle.Regular);Font _font2 = new Font("Arial", 10, FontStyle.Bold);Font _font3 = new Font("Arial", 10, FontStyle.Italic);PDFFont _pdfFont1 = new PDFFont(_font1, false);PDFFont _pdfFont2 = new PDFFont(_font2, false);PDFFont _pdfFont3 = new PDFFont(_font3, false);//DrawString

    graphics1.DrawString(50, 100,

    graphics1.DrawString(50, 150,

    graphics1.DrawString(50, 200,

     

    "Welcome to PDFWriter for .NET", RGBColor.Black, _pdfFont1, 10);"Welcome to PDFWriter for .NET", RGBColor.Red, _pdfFont2, 12, false, false);"Welcome to PDFWriter for .NET by dbAutoTrack Ltd, USA.", RGBColor.Black, _pdfFont3, 12, true, false);//Add the page to the Document

    _document.Pages.Add(page1);

     

    //Initialize new page with PageSize A4.

     

     

    Page page2 = new Page(PageSize.A4);//Get the PDFGraphics object for drawing to the page.

     

     

    PDFGraphics graphics2 = page2.Graphics;//using Standard PDF Fonts

     

     

     

     

    PDFFont _pdfFont4 = new PDFFont(StandardFonts.Helvetica, FontStyle.Regular);PDFFont _pdfFont5 = new PDFFont(StandardFonts.Helvetica, (FontStyle.Bold | FontStyle.Italic));PDFFont _pdfFont6 = new PDFFont(StandardFonts.Helvetica, FontStyle.Bold);//DrawString

    graphics2.DrawString(50, 100,

    graphics2.DrawString(50, 150,

    graphics2.DrawString(50, 200,

     

    "Welcome to PDFWriter for .NET", RGBColor.Black, _pdfFont4, 10);"Welcome to PDFWriter for .NET", RGBColor.Red, _pdfFont5, 12, false, false);"Welcome to PDFWriter for .NET by dbAutoTrack Ltd, USA.", RGBColor.Black, _pdfFont6, 12, false, false);//Add the page to the Document

    _document.Pages.Add(page2);

     

     

    FileStream _fs = new FileStream("TextBox_Sample.pdf", System.IO.FileMode.Create, System.IO.FileAccess.Write);try

    {

     

    //Generate PDF to the stream

    _document.Generate(_fs);

     

    //MessageBox.Show("TextBox_Sample.pdf generated successfully in Bin Folder", "PDF-Writer.NET by dbAutoTrack Ltd, USA.");

    }

     

    finally

    {

    _fs.Flush();

    _fs.Close();

    }

    }

    }

     

    Anyone have any ideas?

Page 1 of 1 (1 items)