True Type Font on 64-bit machines

Last post 02-26-2012, 1:13 PM by codewarior. 15 replies.
Page 1 of 2 (16 items)   1 2 Next >
Sort Posts: Previous Next
  •  06-28-2011, 6:06 PM 313078

    True Type Font on 64-bit machines .NET

    I am using the "C39P24DmTt" to create documents with barcodes on them.  When the application is run on Windows 7 (32-bit) the document created has the barcode glyth on it.  When the application is run on Windows 7 (64-bit) the document created only displays the escape character and not the glyths.  I am build the application in Visual Studio 2010 targeting the "Any CPU" platform.  The Apose.PDF version is 4.7.0.0.

    Here is the code:

        public class PdfReportBuilderIDisposable
        {
    
            private Pdf _pdfDoc;         private bool _writeDirectToFile;         private Aspose.Pdf.TextInfo _textInfoDefault8;         private Aspose.Pdf.TextInfo _textInfoDefault6;         private Aspose.Pdf.TextInfo _textInfoBarcode24;         private Aspose.Pdf.Color _borderColor;
            public PdfReportBuilder(Pdf pdfDoc, bool writeDirectToFile)
            {
                _pdfDoc = pdfDoc;
                _writeDirectToFile = writeDirectToFile;
     
                InitializeAsposeObjects();
            }
     
    
            // This region defines a standardized implementation of the IDisposable 
            // interface, providing safe disposal of managed and unmanaged objects.
            // The _disposed private field tracks whether the object has already
            // been disposed.  By default the object is not disposed.
            private bool _disposed = false;
     
            /// <summary>
            /// Implement IDisposable
            /// Do not make this method virtual
            /// A derived class should not be able to override this method
            /// </summary>
            public void Dispose()
            {
                // Since the code is directly calling the overloaded Dispose method,
                // it passes true as the value for the Boolean disposing parameter.
                Dispose(true);
     
                // Now that the object has been queued for disposal, take it off 
                // the Garbage Collector's (GC's) finalization queue.
                System.GC.SuppressFinalize(this);
     
                // Note that at this point we are never guaranteed that the object
                // has already been disposed.  Whenever the GC gets around to it,
                // that will be the case.  Until then, the private field _disposed
                // must be honored -- i.e. checked prior to accessing any fields or
                // calling any methods of this class in order to guarantee safe
                // code execution.
            }
     
            // Dispose(bool disposing) executes in two distinct scenarios.
            // If disposing equals true, the method has been called directly
            // or indirectly by a user's code.  Managed and unmanaged resources
            // can be disposed. If disposing equals false, the method has been
            // called by the runtime from inside the finalizer and you should
            // not reference other objects. Only unmanaged resources can be
            // disposed in that case.
            private void Dispose(bool disposing)
            {
                // Check to see if Dispose has already been called.
                if (!_disposed)
                {
                    // If disposing equals true then the call has been made by user code.
                    // It is safe to reference other objects.
                    // Proceed to dispose all managed and unmanaged resources.
                    if (disposing)
                    {
                        // Dispose all managed resources
     
                        _textInfoDefault8 = null;
                        _textInfoDefault6 = null;
                        _textInfoBarcode24 = null;
                        _borderColor = null;
                        
                        _pdfDoc = null;
     
                        if (_newDataTable != null)
                        {
                            _newDataTable.Dispose();
                            _newDataTable = null;
                        }
                    }
     
                    // Now that all managed resources have been disposed, proceed to dispose
                    // of all unmanaged resources.
                }
     
                // Flag the object as disposed (even though it will not be so until the GC
                // decides it is time to do so).
                _disposed = true;
            }
     
    
            internal static string CreateReport()         {             bool writeDirectToFile = true;             bool isCreated = false;
                // Special handling for reports
                string reportName = string.Empty;
                FileStream stream = null;
     
                try
                {
                    stream = CreateReportStream(@"Barcode Sheet", out reportName);
                    if (stream == null)
                    {
                        return string.Empty;
                    }
     
                    Pdf pdfDoc;
                    if (writeDirectToFile)
                    {
                        pdfDoc = new Pdf(stream);
                    }
                    else
                    {
                        pdfDoc = new Pdf();
                    }
                    Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
                    pdfLicense.SetLicense(System.Windows.Forms.Application.StartupPath + @"\aspose.total.lic");
     
                    using (PdfReportBuilder reportBuilder = new PdfReportBuilder(pdfDoc, writeDirectToFile))
                    {
                        try
                        {
                            isCreated = reportBuilder.CreateBarcodeSheet();
                        }
                        catch (OutOfMemoryException ex)
                        {
                            MessageBox.Show(ex.Message,
                                            @"Report Generation Failure", MessageBoxButtons.OK, MessageBoxIcon.Error);
     
                            isCreated = true;
                        }
     
                        if (writeDirectToFile)
                        {
                            pdfDoc.Close();
                        }
                        else
                        {
                            pdfDoc.Save(stream);
                        }
                    }
                }
                finally
                {
                    if (stream != null)
                    {
                        stream.Close();
                    }
                }
     
                return isCreated ? reportName : string.Empty;
            }
    
            private static FileStream CreateReportStream(string headerName, out string reportName)         {             FileStream stream = null;             int counter = 0;             do             {                 reportName = string.Format(CultureInfo.CurrentUICulture, Misc.ReportDirectory + @"\{0}_{1}.pdf", FSA.Utility.Misc.UncEncode(headerName), counter);                 try                 {                     // File.Exists here to cover issues with 3rd party PDF readers not putting exclusive lock on the file - ex. FoXiT                     if (File.Exists(reportName))                     {                         File.Delete(reportName);                     }                     stream = new FileStream(reportName, FileMode.Create);                 }                 catch (UnauthorizedAccessException)                 {                     counter++;                 }                 catch (System.Security.SecurityException)                 {                     counter++;                 }                 catch (ArgumentException)                 {                     counter++;                 }                 catch (DirectoryNotFoundException)                 {                     try                     {                         Directory.CreateDirectory(Misc.ReportDirectory);                     }                     catch (UnauthorizedAccessException)                     {                         reportName = string.Empty;                         return null;                     }                     catch (NotSupportedException)                     {                         reportName = string.Empty;                         return null;                     }                     catch (IOException)                     {                         reportName = string.Empty;                         return null;                     }                     catch (ArgumentException)                     {                         reportName = string.Empty;                         return null;                     }                 }                 catch (IOException)                 {                     counter++;                 }             } while (stream == null);             return stream;         }
            private bool CreateBarcodeSheet()         {             string[] countOne = { @"0"@"1"@"2"@"3"@"4"@"5"@"6"@"7"@"8"@"9"@"10" };             string[] countOneCode = { @"*0*"@"*1*"@"*2*"@"*3*"@"*4*"@"*5*"@"*6*"@"*7*"@"*8*"@"*9*"@"*10*" };             string[] countTwo = { @"Back"@"11"@"12"@"13"@"14"@"15"@"16"@"17"@"18"@"19"@"20" };             string[] countTwoCode = { @"*$TV*"@"*11*"@"*12*"@"*13*"@"*14*"@"*15*"@"*16*"@"*17*"@"*18*"@"*19*"@"*20*" };             string[] specCodeName = { @"New Customer"@"Skip"string.Empty, string.Empty, string.Empty, string.Empty, @"Beep High"@"Beep Medium"@"Beep Low"@"No CR"@"CR" };             string[] specCode = { @"*$TX*"@"*0*"string.Empty, string.Empty, string.Empty, string.Empty, @"*.F014$*"@"*.F013$*"@"*.F017$*"@"*.D010$*"@"*.D012$*" };             // Create new section             Section section = _pdfDoc.Sections.Add();             section.PageInfo.Margin.Top = 30;             section.PageInfo.Margin.Bottom = 0;             section.PageInfo.Margin.Left = 20;             section.PageInfo.Margin.Right = 20;             section.PageInfo.PageHeight = PageSize.LetterHeight;             section.PageInfo.PageWidth = PageSize.LetterWidth;             section.IsLandscape = true;             //Title (for Report Titles)             Aspose.Pdf.TextInfo textInfoTitle = new Aspose.Pdf.TextInfo();             textInfoTitle.FontName = @"Helvetica";             textInfoTitle.FontSize = 20;             textInfoTitle.IsTrueTypeFontBold = true;             Table body = new Table(section);             body.ColumnWidths = @"100 125 100 125 150 150";             body.DefaultCellPadding.Bottom = body.DefaultCellPadding.Top = 2;             body.DefaultCellPadding.Left = body.DefaultCellPadding.Right = 2;             body.DefaultCellTextInfo = textInfoTitle;             // Fill Table with bar code information             Row rowItem;             Cell cellItem;             Cell cellBarCode;             Text bcText = null;             Text nameText = null;             Segment segBC = null;             for (int i = 0; i < 11; i++)             {                 rowItem = new Row(body);                 // Column 1                 cellItem = new Cell(rowItem);                 nameText = new Text(countOne[i], textInfoTitle);                 nameText.TextInfo.Alignment = AlignmentType.Center;                 cellItem.Paragraphs.Add(nameText);                 rowItem.Cells.Add(cellItem);                 // Barcode                 cellBarCode = new Cell(rowItem);                 cellBarCode.Padding.Top = 1.0F;                 cellBarCode.DefaultCellTextInfo = _textInfoBarcode24;                 bcText = new Text();                 bcText.Segments.Add(@"       ");                 segBC = new Segment(bcText);                 segBC.Content = string.Format(CultureInfo.CurrentUICulture, @"{0}", countOneCode[i]);                 segBC.TextInfo = _textInfoBarcode24;                 bcText.Segments.Add(segBC);                 cellBarCode.Paragraphs.Add(bcText);                 rowItem.Cells.Add(cellBarCode);                 segBC = null;                 bcText = null;                 cellBarCode = null;                 nameText = null;                 cellItem = null;                 // Column 2                 cellItem = new Cell(rowItem);                 nameText = new Text(countTwo[i], textInfoTitle);                 nameText.TextInfo.Alignment = AlignmentType.Center;                 cellItem.Paragraphs.Add(nameText);                 rowItem.Cells.Add(cellItem);                 // Barcode                 cellBarCode = new Cell(rowItem);                 cellBarCode.Padding.Top = 1.0F;                 cellBarCode.DefaultCellTextInfo = _textInfoBarcode24;                 bcText = new Text();                 bcText.Segments.Add(@"       ");                 segBC = new Segment(bcText);                 segBC.Content = string.Format(CultureInfo.CurrentUICulture, @"{0}", countTwoCode[i]);                 segBC.TextInfo = _textInfoBarcode24;                 bcText.Segments.Add(segBC);                 cellBarCode.Paragraphs.Add(bcText);                 rowItem.Cells.Add(cellBarCode);                 segBC = null;                 bcText = null;                 cellBarCode = null;                 nameText = null;                 cellItem = null;                 // Column 3                 cellItem = new Cell(rowItem);                 nameText = new Text(specCodeName[i], textInfoTitle);                 nameText.TextInfo.Alignment = AlignmentType.Center;                 cellItem.Paragraphs.Add(nameText);                 rowItem.Cells.Add(cellItem);                 // Barcode                 cellBarCode = new Cell(rowItem);                 cellBarCode.Padding.Top = 1.0F;                 cellBarCode.DefaultCellTextInfo = _textInfoBarcode24;                 bcText = new Text();                 bcText.Segments.Add(@"       ");                 segBC = new Segment(bcText);                 segBC.Content = string.Format(CultureInfo.CurrentUICulture, @"{0}", specCode[i]);                 segBC.TextInfo = _textInfoBarcode24;                 bcText.Segments.Add(segBC);                 cellBarCode.Paragraphs.Add(bcText);                 rowItem.Cells.Add(cellBarCode);                 segBC = null;                 bcText = null;                 cellBarCode = null;                 nameText = null;                 cellItem = null;                 // Add row                 body.Rows.Add(rowItem);                 rowItem = null;                 // Add an extra line between rows                 rowItem = new Row(body);                 rowItem.Cells.Add(string.Empty);                 body.Rows.Add(rowItem);                 rowItem = null;             }             // Add Table to section             if (_writeDirectToFile)             {                 section.AddParagraph(body);             }             else             {                 section.Paragraphs.Add(body);             }             body = null;             // Return             return true;         }
            private void InitializeAsposeObjects()
            {
                //Default 8
                _textInfoDefault8 = new Aspose.Pdf.TextInfo();
                _textInfoDefault8.FontName = @"Helvetica";
                _textInfoDefault8.FontSize = 8;
     
                //Default 6
                _textInfoDefault6 = new Aspose.Pdf.TextInfo();
                _textInfoDefault6.FontName = @"Helvetica";
                _textInfoDefault6.FontSize = 6;
     
                //BarCode 24
                _textInfoBarcode24 = new Aspose.Pdf.TextInfo();
                _textInfoBarcode24.IsFontEmbedded = true;
                _textInfoBarcode24.FontName = @"C39P24DmTt";
                _textInfoBarcode24.FontSize = 24;
                _textInfoBarcode24.Alignment = AlignmentType.FullJustify;
     
                _borderColor = new Aspose.Pdf.Color(@"Black");
            }
       }
     
  •  06-29-2011, 7:32 AM 313200 in reply to 313078

    Re: True Type Font on 64-bit machines

    Attachment: Present (inaccessible)

    Hello Charles,

    Thanks for using our products.

    I have tested the scenario over Windows 7 Professional X64 in Visual Studio 2010 Ultimate project while using Aspose.Pdf for .NET 5.3.0 and I am unable to notice any problem. Please take a look over the attached PDF document that I have generated using code snippet that you have shared earlier.

    Can you please try using v5.3.0 and in case you still face any problem or you have any further query, please feel free to contact. We apologize for your inconvenience.


    Nayyer Shahbaz
    Support Developer, Aspose Sialkot Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
  •  06-29-2011, 11:02 AM 313251 in reply to 313200

    Re: True Type Font on 64-bit machines

    Attachment: Present (inaccessible)

    V5.3.0.0 did resolve the barcode issue while running on an x64 Windows 7.  But unfortunately v5.3.0.0 breaks other reports that span multiple pages.  The header is not honored after the first page.  I have attached a report generated with v4.7.0.0 and the same report generated with v5.3.0.0.

     
  •  06-29-2011, 2:51 PM 313327 in reply to 313251

    Re: True Type Font on 64-bit machines

    Hello Charles,

    Can you please share some code snippet that can help us in replicating the table header issue at our end. We are really sorry for this inconvenience.


    Nayyer Shahbaz
    Support Developer, Aspose Sialkot Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
  •  06-29-2011, 7:05 PM 313367 in reply to 313327

    Re: True Type Font on 64-bit machines

    Please refer to http://www.aspose.com/community/forums/thread/267802.aspx.  The code in that issue is the same code being used here.
     
  •  06-30-2011, 4:03 AM 313431 in reply to 313367

    Re: True Type Font on 64-bit machines

    Hello Charles,

    I have tested the scenario and have observed that the issue is occurring because Top margin of table is being ignored if we set Table.IsFirstRowRepeated to true. For the sake of correction, I have logged this issue as PDFNET-28825 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. We are really sorry for this inconvenience.


    Nayyer Shahbaz
    Support Developer, Aspose Sialkot Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
  •  08-02-2011, 3:08 PM 320104 in reply to 313431

    Re: True Type Font on 64-bit machines

    Has there been any movement on this issue?  When can I expect a resolution?
     
  •  08-02-2011, 10:37 PM 320139 in reply to 320104

    Re: True Type Font on 64-bit machines

    Hello Charles,

    Thanks for your patience.

    Our development team is working hard to get this issue resolved but I am afraid its not yet completely fixed. I have requested the development team to share the ETA regarding its resolution. As soon as I have the required information, I will be more than happy to update you with the status of correction. Please be patient and spare us little time. We are really sorry for the delay and inconvenience.

    Nayyer Shahbaz
    Support Developer, Aspose Sialkot Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
  •  09-13-2011, 11:50 AM 329045 in reply to 320139

    Re: True Type Font on 64-bit machines

    Another month has gone by!  Is there any movement on this issue?  When can I expect a resolution?
     
  •  09-14-2011, 7:49 AM 329307 in reply to 329045

    Re: True Type Font on 64-bit machines

    Hello Charles,

    Thanks for your patience.

    I am afraid the issue is not yet resolved. Due to some technical difficulties, this issue has taken longer time than we expected. Nevertheless, I have sent another intimation to the development team to share any possible dates regarding its resolution. Once again my humble request is to please be little more patient and spare us little time. We are really sorry for the delay and inconvenience.

    Your patience and comprehension is greatly appreciated in this regard.

    Nayyer Shahbaz
    Support Developer, Aspose Sialkot Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
  •  09-15-2011, 9:37 AM 329604 in reply to 329045

    Re: True Type Font on 64-bit machines

    Hello Charles,

    I have been able to get the ETA from the development team and as per our current estimate, we expect to get this issue fixed in Q4. We will try our level best to get it fixed in our next release version planned to be released in October2011 but still its not a promise. As soon as the hotfix becomes available, we would be more than happy to update you with the status of correction. Your patience and comprehension is greatly appreciated in this regard.

    Nayyer Shahbaz
    Support Developer, Aspose Sialkot Team
    About Us
    Contact Us

    Keep in touch! We're on Twitter and Facebook
     
  •  01-03-2012, 10:54 AM 352780 in reply to 329604

    Re: True Type Font on 64-bit machines

    Ok, it is well past the October time frame, has this issue been resolved yet?

    This is becoming a critical issue for use.  We can not upgrade to the last Aspose version to resolve the 64-bit True Type Font issues because of the header with a table that has a repeating first row (PDFNET-28825 PDFNET-28825) issue with the latest version.  When can I have a resolution?

     
  •  02-03-2012, 10:39 AM 359227 in reply to 352780

    Re: True Type Font on 64-bit machines

    I really need a status on issue PDFNET-28825 PDFNET-28825PDFNET-28825 PDFNET-28825!  Please respond!
     
  •  02-06-2012, 1:36 AM 359373 in reply to 359227

    Re: True Type Font on 64-bit machines

    Hi Chuck,

    Please accept our apologies for a delayed response.

    I have asked our development team to share the details regarding your reported issue. As soon as I get a response, I will update you via this forum thread.

    Sorry for the inconvenience,


    Nausherwan Aslam
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  02-07-2012, 12:56 PM 359848 in reply to 359373

    Re: True Type Font on 64-bit machines

    Aspose.PDF.Dll version 6.6.0.0 seems to resolve the issue but introduces a new bug.  I have created a new post for the new bug.

     
Page 1 of 2 (16 items)   1 2 Next >
View as RSS news feed in XML