google-code-export / purepdf

Automatically exported from code.google.com/p/purepdf
2 stars 1 forks source link

Error 1069 - property undefined #9

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Here is the stack trace for the issue. The problem occurred on a windows xp 
computer running adobe air 2.0.

StackTrace: ReferenceError: Error #1069: Property undefined not found on 
__AS3__.vec.Vector.<int> and there is no default value.
       at org.purepdf.pdf.fonts::BaseFont/_getWidthI()[/Users/alessandro/Documents/Workspaces/Flash/Opensource/purePDF/src/org/purepdf/pdf/fonts/BaseFont.as:403]
       at org.purepdf.pdf.fonts::BaseFont/getWidth()[/Users/alessandro/Documents/Workspaces/Flash/Opensource/purePDF/src/org/purepdf/pdf/fonts/BaseFont.as:272]
       at org.purepdf.pdf.fonts::BaseFont/getWidthPoint()[/Users/alessandro/Documents/Workspaces/Flash/Opensource/purePDF/src/org/purepdf/pdf/fonts/BaseFont.as:284]
       at org.purepdf.pdf::PdfFont/getWidth()[/Users/alessandro/Documents/Workspaces/Flash/Opensource/purePDF/src/org/purepdf/pdf/PdfFont.as:107]
       at org.purepdf.pdf::PdfChunk/getCharWidth()[/Users/alessandro/Documents/Workspaces/Flash/Opensource/purePDF/src/org/purepdf/pdf/PdfChunk.as:305]
       at org.purepdf.pdf::PdfChunk/split()[/Users/alessandro/Documents/Workspaces/Flash/Opensource/purePDF/src/org/purepdf/pdf/PdfChunk.as:438]
       at org.purepdf.pdf::PdfLine/add()[/Users/alessandro/Documents/Workspaces/Flash/Opensource/purePDF/src/org/purepdf/pdf/PdfLine.as:294]
       at org.purepdf.pdf::PdfDocument/addElement()[/Users/alessandro/Documents/Workspaces/Flash/Opensource/purePDF/src/org/purepdf/pdf/PdfDocument.as:346]
       at org.purepdf.elements::Phrase/process()[/Users/alessandro/Documents/Workspaces/Flash/Opensource/purePDF/src/org/purepdf/elements/Phrase.as:332]
       at org.purepdf.pdf::PdfDocument/addElement()[/Users/alessandro/Documents/Workspaces/Flash/Opensource/purePDF/src/org/purepdf/pdf/PdfDocument.as:320]
       at org.purepdf.pdf::PdfDocument/add()[/Users/alessandro/Documents/Workspaces/Flash/Opensource/purePDF/src/org/purepdf/pdf/PdfDocument.as:552]
       ...
       at flash.events::EventDispatcher/dispatchEventFunction()
       at flash.events::EventDispatcher/dispatchEvent()
       at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9440]
       at mx.controls::MenuBar/eventHandler()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\MenuBar.as:1400]
       at flash.events::EventDispatcher/dispatchEventFunction()
       at flash.events::EventDispatcher/dispatchEvent()
       at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9440]
       at mx.controls::Menu/dispatchEvent()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:1319]
       at mx.controls::Menu/mouseUpHandler()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\controls\Menu.as:1692]
ID:1069
Title:ReferenceError
Message:Error #1069: Property undefined not found on __AS3__.vec.Vector.<int> 
and there is no default value.
Error Message ReferenceError: Error #1069: Property undefined not found on 
__AS3__.vec.Vector.<int> and there is no default value.

Original issue reported on code.google.com by trent.we...@gmail.com on 6 Oct 2010 at 3:52

GoogleCodeExporter commented 9 years ago
Got exactly the same Error while trying to compose a huge table with these 
lines:

(widths:Array of numbers)
(table:SimpleTable)
var pdt:PdfPTable = table.createPdfPTable();
pdt.setNumberWidths(Vector.<Number>(widths));
pdfDocument.add(pdt);

Original comment by pcfan.s...@gmail.com on 13 Oct 2010 at 7:04

GoogleCodeExporter commented 9 years ago
P.S. 
Got the same with pdfDocument.add(table) with the same context like my first 
comment.
Both methods worked with a smaller test table.

Original comment by pcfan.s...@gmail.com on 13 Oct 2010 at 7:10

GoogleCodeExporter commented 9 years ago
Think I've got it.
The text I want to render contains local characters (diacritics) and the fonts 
used by purePdf can't interpret such characters. After a few pre-processing 
(excluding the diacritics from the text) everything went ok.

Original comment by pcfan.s...@gmail.com on 13 Oct 2010 at 10:22

GoogleCodeExporter commented 9 years ago
The user that reported the problem is brazilian and he might have had some 
non-standard characters. Any ideas on how to fix it so it supports non standard 
characters?

Original comment by trent.we...@gmail.com on 13 Oct 2010 at 4:11

GoogleCodeExporter commented 9 years ago
Here is the solution to the problem. This is line 398 of the BaseFont.as. I 
randomly chose code 125 so that might be wrong but it seems to work fine. It 
just removes the invalid character which in this case was 8806. A greater then 
or equal to character.

protected function _getWidthI( code: int ): int
{
  if ( fastWinansi )
  {
    if ( code < 128 || ( code >= 160 && code <= 255 ) ) {
      return widths[ code ];
    } else {                    
      if (PdfEncodings.winansi[ code ]!= undefined) {
        return widths[ PdfEncodings.winansi[ code ] ];
      } else {
        return widths[125]; 
      }
    }
  } else {
.............

Original comment by trent.we...@gmail.com on 15 Oct 2010 at 10:27

GoogleCodeExporter commented 9 years ago
Can you provide a sample project to reproduce this error?

Original comment by alessand...@gmail.com on 14 Jan 2011 at 11:35

GoogleCodeExporter commented 9 years ago
For example "Hello World" with local characters generate this error:

...
createDocument( "Hello World" );
document.open();
document.add( new Paragraph("Widzew Łódź ęółśążźćń 
ĘÓŁŚĄŻŹĆŃ") );
document.close();
...

Original comment by anal...@bly.pl on 9 Aug 2011 at 11:30