Sign In  Sign Up Live-Chat

Barcode conversion

Last post 02-27-2007, 7:29 PM by jthake. 17 replies.
Page 1 of 2 (18 items)   1 2 Next >
Sort Posts: Previous Next
  •  07-03-2005, 2:37 PM 23327

    Barcode conversion

    Hi,

    I'm working on an application which creates mailmerge documents with Aspose.Word.
    In these documents a barcode font is used to show a reference number.
    This works just fine.
    When I try to convert the documents to PDF by using Aspose.PDF the reference number is shown with a normal font instead of the barcode font.
    Is this by design or am I doing something wrong?

    Greetings,
    Erik-Jan Wardenier
     
  •  07-03-2005, 4:36 PM 23330 in reply to 23327

    Re: Barcode conversion

    Dear Wert,

    Thank you for considering Aspose.

    Can you please provide an example and let me test it?

    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  07-04-2005, 4:10 AM 23364 in reply to 23330

    Re: Barcode conversion

    Attachment: Present (inaccessible)
    Dear Forever,
    We are using the 'Code 39 truetype font package' found at: http://www.barcodesinc.com/free-barcode-font/

    In this example I created the barcoded part like this:

                    bldr = New DocumentBuilder(doc)
                    bldr.MoveToBookmark("bmRefNo")
                    bldr.Font.Name = "Free 3 of 9 Extended"
                    bldr.Font.Size = 28
                    bldr.Write("*" & sRefNo & "*")
     
    Kind regards,

    Erik-Jan Wardenier

     
  •  07-04-2005, 6:10 AM 23377 in reply to 23364

    Re: Barcode conversion

    I have reproduced this error. I will check the reason and reply to you soon.


    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  07-04-2005, 6:33 AM 23379 in reply to 23377

    Re: Barcode conversion

    I have found that font embeding is needed to display the barcode. It is not supported to set font embeding in Aspose.Word so you have to add IsFontEmbedded="true" into the xml by yourself. You can test the following example:
    <?xml version="1.0" encoding="UTF-8"?>
    <Pdf xml:space="preserve" TabStopPosition="36"  IsFontEmbedded="true" IsCoreFontUsed="false" IsPageNumberForDocument="true" xmlns="Aspose.Pdf">
      <Section PageWidth="612" PageHeight="792" PageMarginTop="72" PageMarginBottom="72" PageMarginLeft="90" PageMarginRight="90" IsNewPage="true">
        <Text IsSpaced="true" LineSpacing="2.94" ID="bmRefNo">
          <Segment FontName="Free 3 of 9 Extended" Color="rgb 0 0 0" FontSize="28">*123456*</Segment>
        </Text>
      </Section>
    </Pdf>
    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  07-05-2005, 12:48 AM 23430 in reply to 23379

    Re: Barcode conversion

    Thanks,

    This does the trick, although I consider it more or less as a work around.

    Kind regards,
    Erik-Jan Wardenier

     
  •  09-05-2005, 3:37 AM 28068 in reply to 23379

    Re: Barcode conversion

    Dear Forever,

    We have been using your solutions for some weeks now.
    The following problem arises: the documents are getting very big (450kb instead of 45kb).
    This is caused by embedding the font.
    We generate around 20 documents on each run.
    Is there a way to decrease the size of the pdfs?

    Kind regards,
    Erik-Jan Wardenier
     
  •  09-05-2005, 6:44 AM 28082 in reply to 28068

    Re: Barcode conversion

    Dear Erik-Jan,

    Thank you for considering Aspose.

    I will keep this issue in my mind and try to find a solution.
    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  09-20-2005, 12:37 AM 29329 in reply to 28082

    Re: Barcode conversion

    I have tested this issue and found if you use the following xml:
        <Text IsSpaced="true" LineSpacing="2.94">
          <Segment FontName="Free 3 of 9 Extended Regular" Color="rgb 0 0 0" FontSize="28" IsUnicode="true">*123456*</Segment>
        </Text>
    the resulting pdf will be smaller. Note that you should set IsUnicode to true and the fontname should be Free 3 of 9 Extended Regular.
    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  12-21-2006, 2:14 AM 63979 in reply to 29329

    Re: Barcode conversion

    I followed these steps and added the IsUnicode="true" to the following XML using XPath and XmlDocument.


    <?xml version="1.0" encoding="UTF-8"?><Pdf xml:space="preserve" TabStopPosition="36" IsCoreFontUsed="false" IsPageNumberForDocument="true" xmlns="Aspose.Pdf">
      <Section PageWidth="595.3" PageHeight="841.9" PageMarginTop="27" PageMarginBottom="9" PageMarginLeft="45.1" PageMarginRight="46.2" IsNewPage="true">
        <Table ColumnWidths="261 18 45 153 45" MarginLeft="-9" DefaultCellPaddingLeft="5.4" DefaultCellPaddingRight="5.4" IsRowBroken="false" IsFirstRowRepeated="false">
          <Row>
            <Cell>
              <Text IsSpaced="true" LineSpacing="5.4" ID="DOCUMENTIDBARCODE">
                <Segment FontName="Free 3 of 9 Extended" FontSize="36" IsUnicode="true">*</Segment>
                <Segment FontName="Free 3 of 9 Extended" FontSize="36" IsUnicode="true">7002498</Segment>
                <Segment FontName="Free 3 of 9 Extended" FontSize="36" IsUnicode="true">*</Segment>
              </Text>
            </Cell>
          </Row>
        </Table>
      </Section>
    </Pdf>

    But the barcode doesn't dispaly in the PDF. If I save the word document out before converting to PDF...the barcode is in there fine.

    Have you got any other suggestions?

    BTW here's how I added the attribute.

                    XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);
                    nsmgr.AddNamespace("apdf", "Aspose.Pdf");

                    //hackery to get font included in PDF find
                    //<Segment FontName="Free 3 of 9" FontSize="36">
                    //and replace with
                    //<Segment FontName="Free 3 of 9" FontSize="36" IsUnicode="true">
                    foreach (XmlElement barcodeFontSegmentNode in xmlDoc.SelectNodes("//apdf:Segment[@FontName='Free 3 of 9']", nsmgr))
                    {
                        barcodeFontSegmentNode.SetAttribute("IsUnicode", "true");
                        barcodeFontSegmentNode.SetAttribute("FontName", "Free 3 of 9 Extended");
                    }


    Thanks
    Jeremy Thake

     
  •  12-21-2006, 4:59 AM 63990 in reply to 63979

    Re: Barcode conversion

    Dear Jeremy,

    Using this solution, you have to set the font name as "Free 3 of 9 Extended Regular" as you can see from the system's fonts folder.


    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  12-21-2006, 5:27 PM 64024 in reply to 63990

    Re: Barcode conversion

    I did try that and that didn't work.

    I will download the font again and remove it and add it again and try again.

    Any other suggestions of what else it could be?

    How can I confirm the font name in Windows/Fonts folder...is it the filename without the .ttf?

    Thanks
    Jeremy
     
  •  12-21-2006, 7:04 PM 64030 in reply to 64024

    Re: Barcode conversion

    Attachment: Present (inaccessible)

    Dear Jeremy,

    You can double click the font file to see the font name. For this font, the name at the top is "Free 3 of 9 Extended Regular" and the font name at the second line is "Free 3 of 9 Extended".  Both these names should be correct font name. I have attached the new dll that support both two font names. If you are using fontmap like the following:

       pdf.IsTruetypeFontMapCached = true;
       pdf.TruetypeFontMapPath = @"d:\test";

    Please delete the Aspose.Pdf.TruetypeFontMap.xml in the TruetypeFontMapPath and let it regenerated.


    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  02-26-2007, 10:33 PM 68908 in reply to 64030

    Re: Barcode conversion

    I have got it working so that when viewing the PDF it shows the barcode correctly. Based on using:

                    XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);
                    nsmgr.AddNamespace("apdf", "Aspose.Pdf");

                    foreach (XmlElement barcodeFontSegmentNode in xmlDoc.SelectNodes("//apdf:Segment[@FontName='Free 3 of 9 Extended Regular']", nsmgr))
                    {
                        barcodeFontSegmentNode.SetAttribute("IsUnicode", "true");
     barcodeFontSegmentNode.SetAttribute("TruetypeFontFileName", @"C:\WINDOWS\Fonts\FRE3OF9X.TTF");
                    }


    But now when I actually try and print the PDF to a printer the printer warms up and nothing comes out. If I go to advanced button and tick the check box "Print as image" it actually works.

    Is there a setting I can set in the PDF that will automatically set this setting?

    Thanks very much,
    Jeremy
     
  •  02-26-2007, 11:56 PM 68912 in reply to 68908

    Re: Barcode conversion

    Dear Jeremy,

    Do you mean setting the "Print as image"? I don't think it can be set in Pdf document.

    I tried printing with mormal mode and it works well. Can you please provide a example xml that can reproduce this error?


    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
Page 1 of 2 (18 items)   1 2 Next >
View as RSS news feed in XML