Comments (9)
Confirmed. Great work.
from itextsharp.lgplv2.core.
Thank you.
What exceptions are reported? These tests need some modifications to run on Linux. For instance in the TestUtils class, c:\windows\fonts is defined as the fonts folder or GetBaseDir should be adjusted too.
from itextsharp.lgplv2.core.
I did notice the issue with the font paths, but the error that hits right away seems to be this other issue. Here's an example of the text exception:
Error Message:
Test method iTextSharp.LGPLv2.Core.FunctionalTests.RtfTests.Verify_PDF_To_RTF_File_CanBeCreated threw exception:
System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
Stack Trace:
at System.String.Substring(Int32 startIndex, Int32 length)
at iTextSharp.LGPLv2.Core.FunctionalTests.TestUtils.GetBaseDir() in /lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Core.FunctionalTests/TestUtils.cs:line 20
at iTextSharp.LGPLv2.Core.FunctionalTests.TestUtils.GetOutputFolder() in /lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Core.FunctionalTests/TestUtils.cs:lin
e 25
at iTextSharp.LGPLv2.Core.FunctionalTests.RtfTests.Verify_PDF_To_RTF_File_CanBeCreated() in /lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Core.FunctionalTes
ts/RtfTests.cs:line 19
I dropped in a couple of WriteLines in for debugging within my docker container, to see what the root and idx values were. Here's the modifed method and console output:
public static string GetBaseDir()
{
var currentAssembly = typeof(TestUtils).GetTypeInfo().Assembly;
var root = Path.GetDirectoryName(currentAssembly.Location);
var idx = root.IndexOf(@"\bin", StringComparison.OrdinalIgnoreCase);
Console.WriteLine("Print root:" + root);
Console.WriteLine("Print idx:" + idx);
return root.Substring(0, idx);
}
Output:
Print root: /lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Core.FunctionalTests/bin/Debug/netcoreapp1.0
Print idx: -1
The index should obviously not equal to -1.
from itextsharp.lgplv2.core.
ok and now this issue was kindof fixed by just removing the @ symbol in this line:
var idx = root.IndexOf(@"\bin", StringComparison.OrdinalIgnoreCase);
After removing the @ symbol 44 tests pass, but the results are stored in a directory named "b". Must be something to do with support for string literals..? I haven't been able to get it to work with "\bin".
from itextsharp.lgplv2.core.
GetBaseDir()
is not an important method. You can replace it with the following path on your system:
return "/lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Core.FunctionalTests/";
Final produced PDF files will be stored there.
from itextsharp.lgplv2.core.
This issue can be fixed by using a platform specific directory separator char:
var idx = root.IndexOf($"{Path.DirectorySeparatorChar}bin", StringComparison.OrdinalIgnoreCase);
Also I updated the repository to reflect these changes. Please use a new clone to run the tests.
from itextsharp.lgplv2.core.
Thank you. That works perfect! 👍 👍 Now 46/60 tests passing...
Here is the next type of error below. The next different type of error is a FileNotFoundException, It looks like the root path gets preppended to whole resource path for the image. Any pdf looking for a resource has the same issue.
Failed Verify_iTextXML_To_PDF_File_CanBeCreated
Error Message:
Test method iTextSharp.LGPLv2.Core.FunctionalTests.XmlITextTests.Verify_iTextXML_To_PDF_File_CanBeCreated threw exception:
System.IO.FileNotFoundException: Could not find file '/lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Core.FunctionalTests/\\lib\iTextSharp.LGPLv2.Core\src\iText
Sharp.LGPLv2.Core.FunctionalTests\iTextExamples\resources\img\hitchcock.png'.
Stack Trace:
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
at Interop.CheckIo[TSafeHandle](TSafeHandle handle, String path, Boolean isDirectory, Func`2 errorRewriter)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
at System.IO.UnixFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, FileStream parent)
at System.IO.UnixFileSystem.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, FileStream parent)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at iTextSharp.LGPLv2.Core.System.NetUtils.WebUtils.GetResponseStream(Uri url) in /lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Core/System/NetUtils/WebUtils
.cs:line 15
at iTextSharp.text.Image.GetInstance(Uri url) in /lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Core/iTextSharp/text/Image.cs:line 938
at iTextSharp.text.Image.GetInstance(String filename) in /lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Core/iTextSharp/text/Image.cs:line 1353
at iTextSharp.text.factories.ElementFactory.GetImage(Properties attributes) in /lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Core/iTextSharp/text/factories/
ElementFactory.cs:line 227
at iTextSharp.text.xml.TextHandler.HandleStartingTags(String name, Properties attributes) in /lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Core/iTextSharp/t
ext/xml/ITextHandler.cs:line 656
at iTextSharp.text.xml.TextHandler.StartElement(String uri, String lname, String name, Hashtable attrs) in /lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Cor
e/iTextSharp/text/xml/ITextHandler.cs:line 853
at iTextSharp.text.xml.ParserBase.Parse(XmlReader reader) in /lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Core/iTextSharp/text/xml/ParserBase.cs:line 59
at iTextSharp.text.xml.XmlParser.Go(IDocListener document, XmlReader reader) in /lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Core/iTextSharp/text/xml/XmlPa
rser.cs:line 134
at iTextSharp.LGPLv2.Core.FunctionalTests.XmlITextTests.converITextXmlToPdfFile(String iTextXML, String pdfFilePath) in /lib/iTextSharp.LGPLv2.Core/src/iTextSha
rp.LGPLv2.Core.FunctionalTests/XmlITextTests.cs:line 2000
at iTextSharp.LGPLv2.Core.FunctionalTests.XmlITextTests.Verify_iTextXML_To_PDF_File_CanBeCreated() in /lib/iTextSharp.LGPLv2.Core/src/iTextSharp.LGPLv2.Core.Fun
ctionalTests/XmlITextTests.cs:line 52
from itextsharp.lgplv2.core.
from itextsharp.lgplv2.core.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related problems.
from itextsharp.lgplv2.core.
Related Issues (20)
- html2pdf image display error HOT 1
- PDF Reader does not read the text from pdf. unit test case is also failing. HOT 1
- `System.Drawing.Common` no longer supported for non-Windows
- AES encryption | Don't Encrypt Meta Data fails to encrypt the pdf document HOT 6
- Strong naming the library HOT 1
- The PdfWriter ExtraCatalog property doesn't seem to work as expected
- Is there a easy way to convert from iTextSharp Image to SKBitmap?
- Wrong page split on nested PdfPTable HOT 2
- Add Font Location for Windows HOT 1
- Endless loop HOT 2
- Specified cast is not valid while reading a TIFF file
- Is there a way to insert svg as a background to PDF ? HOT 1
- Adding a scaled an image to a document produces PDF with the same size as not-scaled image. HOT 1
- Error when reading a large PDF file
- itextsharp.lgplv2.core is missing NuGet package README file HOT 1
- Open encrypted pdf issue
- System.MissingMethodException when migrate from 1.9.4 to 3.4.17 HOT 2
- The strange issue of deleting images from a PDF using iTextSharp HOT 1
- Error when extracting images from some tif files HOT 1
- Manipulating many large files use a large amount of memory
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from itextsharp.lgplv2.core.