Paper's imageable width is too small in java crstal report - java

We are using java Cristal report for printing.
We have a problem in printing from label printers.
it throws,
Caused by: com.crystaldecisions.sdk.occa.report.lib.ReportSDKPrinterException: Report could not be printed.
at com.businessobjects.crystalreports.printer.bean.Printer.X(Unknown Source) ~[CrystalReportsRuntime-12.2.216.2042.jar:12.2.216.2042]
at com.businessobjects.crystalreports.printer.bean.ReportPrinter.print(Unknown Source) ~[CrystalReportsRuntime-12.2.216.2042.jar:12.2.216.2042]
at com.businessobjects.crystalreports.printer.bean.ReportPrinter.print(Unknown Source) ~[CrystalReportsRuntime-12.2.216.2042.jar:12.2.216.2042]
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.printReport(SourceFile:711) ~[CrystalReportsRuntime-12.2.216.2042.jar:12.2.216.2042]
... 161 common frames omitted
Caused by: java.awt.print.PrinterException: Paper's imageable width is too small.
this is the code use for printing
printerJob.printDialog();
reportClientDocument.getPrintOutputController().printReport(printerJob, null);
can any one know why this happens ?

Related

PDFBox failing with DamagedFontException (Arial font)

I am trying to parse the existing PDF and it is failing with DamagedFontException.
I looked at the PDF and it is using Arial font. So I am trying right now to add Arial font and this is the error I am getting now.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/fontbox/ttf/TTFParser
at org.apache.pdfbox.pdmodel.font.PDType0Font.load(PDType0Font.java:147)
at org.apache.pdfbox.examples.interactive.form.FillFormField.main(FillFormField.java:54)
Caused by: java.lang.ClassNotFoundException: org.apache.fontbox.ttf.TTFParser
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 2 more
I modified the existing FillFormField class in PDFBox examples and added the Arial text field to the test PDF and was able to reproduce the error.
Here is the code which I added:
PDAcroForm acroForm = pdfDocument.getDocumentCatalog().getAcroForm();
acroForm.getDefaultResources().put(
COSName.getPDFName("Arial"),
PDType0Font.load(pdfDocument, new File("src/main/resources/org/apache/pdfbox/Arial.ttf")));
What I am doing wrong? My main goal is to just fill the form in the document, and that's it.
UPDATE:
The DamageFontException happens when I just modify existing PDF in the example
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/fontbox/type1/DamagedFontException
at org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:76)
at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:143)
at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.validateAndEnsureAcroFormResources(AppearanceGeneratorHelper.java:150)
at org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.<init>(AppearanceGeneratorHelper.java:111)
at org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:261)
at org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:210)
at org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:218)
at org.apache.pdfbox.examples.interactive.form.FillFormField.main(FillFormField.java:87)
Caused by: java.lang.ClassNotFoundException: org.apache.fontbox.type1.DamagedFontException
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 8 more

Eclipse. Saving workspace takes forever

My problem is that after closing eclipse the saving workspace didn't finish even after two hours and make me cant do anything on eclipse at all. I checked in
C:..\workspace.metadata.log and the error is :
!ENTRY org.eclipse.jdt.ui 4 10001 2016-12-25 12:51:13.037
!MESSAGE Internal Error
!STACK 1
Java Model Exception: Core Exception [code 3] Some characters cannot be mapped using "Cp1252" character encoding.
Either change the encoding or remove the characters which are not supported by the "Cp1252" character encoding.
at org.eclipse.jdt.internal.ui.javaeditor.DocumentAdapter.save(DocumentAdapter.java:474)
at org.eclipse.jdt.internal.core.CommitWorkingCopyOperation.executeOperation(CommitWorkingCopyOperation.java:123)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:729)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:794)
at org.eclipse.jdt.internal.core.CompilationUnit.commitWorkingCopy(CompilationUnit.java:391)
at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType(NewTypeWizardPage.java:2233)
at org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard.finishPage(NewClassCreationWizard.java:71)
at org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run(NewElementWizard.java:118)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:729)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5358)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Caused by: java.nio.charset.UnmappableCharacterException: Input length = 1
at java.nio.charset.CoderResult.throwException(Unknown Source)
at java.nio.charset.CharsetEncoder.encode(Unknown Source)
at org.eclipse.core.internal.filebuffers.ResourceTextFileBuffer.commitFileBufferContent(ResourceTextFileBuffer.java:366)
at org.eclipse.core.internal.filebuffers.ResourceFileBuffer.commit(ResourceFileBuffer.java:327)
at org.eclipse.jdt.internal.ui.javaeditor.DocumentAdapter.save(DocumentAdapter.java:472)
... 14 more
Caused by: org.eclipse.core.runtime.CoreException: Some characters cannot be mapped using "Cp1252" character encoding.
Either change the encoding or remove the characters which are not supported by the "Cp1252" character encoding.
at org.eclipse.core.internal.filebuffers.ResourceTextFileBuffer.commitFileBufferContent(ResourceTextFileBuffer.java:378)
at org.eclipse.core.internal.filebuffers.ResourceFileBuffer.commit(ResourceFileBuffer.java:327)
at org.eclipse.jdt.internal.ui.javaeditor.DocumentAdapter.save(DocumentAdapter.java:472)
at org.eclipse.jdt.internal.core.CommitWorkingCopyOperation.executeOperation(CommitWorkingCopyOperation.java:123)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:729)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:794)
at org.eclipse.jdt.internal.core.CompilationUnit.commitWorkingCopy(CompilationUnit.java:391)
at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType(NewTypeWizardPage.java:2233)
at org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard.finishPage(NewClassCreationWizard.java:71)
at org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run(NewElementWizard.java:118)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:729)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2313)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5358)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Caused by: java.nio.charset.UnmappableCharacterException: Input length = 1
at java.nio.charset.CoderResult.throwException(Unknown Source)
at java.nio.charset.CharsetEncoder.encode(Unknown Source)
at org.eclipse.core.internal.filebuffers.ResourceTextFileBuffer.commitFileBufferContent(ResourceTextFileBuffer.java:366)
... 16 more
The problem is I dont know how can i fixed it without opening eclipse (I cant because its saving workspace).
I'll be greatfull for help.
PS. Sorry for my english I'm not native speaker.
In top menu of Eclipse go to Window Menu
Windows Menu –> Preferences –> General (expand it) –> Workspace
(click on it).
Look for a box “Text File Encoding”. Default will be
“Cp1252″.
Change radio to select other and select “UTF-8″ from combo
box.
After setting this UTF-8 encoding, you can use UTF-8 in your code. Now you won’t get the ‘CP1252 character encoding’ error.

How to retrieve full exception message from compiled jar without changing the code?

Java application terminates with exception:
liquibase.exception.LiquibaseException: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: java.lang.NumberFormatException
at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:211)
at liquibase.integration.commandline.Main.doMigration(Main.java:967)
at liquibase.integration.commandline.Main.run(Main.java:180)
at liquibase.integration.commandline.Main.main(Main.java:99)
Caused by: liquibase.command.CommandExecutionException: liquibase.exception.DatabaseException: java.lang.NumberFormatException
at liquibase.command.AbstractCommand.execute(AbstractCommand.java:13)
at liquibase.integration.commandline.CommandLineUtils.doDiffToChangeLog(CommandLineUtils.java:209)
... 3 more
Caused by: liquibase.exception.DatabaseException: java.lang.NumberFormatException
at liquibase.snapshot.jvm.ColumnSnapshotGenerator.addTo(ColumnSnapshotGenerator.java:120)
at liquibase.snapshot.jvm.JdbcSnapshotGenerator.snapshot(JdbcSnapshotGenerator.java:73)
at liquibase.snapshot.SnapshotGeneratorChain.snapshot(SnapshotGeneratorChain.java:50)
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:194)
at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:292)
at liquibase.snapshot.DatabaseSnapshot.replaceObject(DatabaseSnapshot.java:314)
at liquibase.snapshot.DatabaseSnapshot.includeNestedObjects(DatabaseSnapshot.java:234)
at liquibase.snapshot.DatabaseSnapshot.include(DatabaseSnapshot.java:208)
at liquibase.snapshot.DatabaseSnapshot.init(DatabaseSnapshot.java:70)
at liquibase.snapshot.DatabaseSnapshot.<init>(DatabaseSnapshot.java:44)
at liquibase.snapshot.JdbcDatabaseSnapshot.<init>(JdbcDatabaseSnapshot.java:21)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:150)
at liquibase.snapshot.SnapshotGeneratorFactory.createSnapshot(SnapshotGeneratorFactory.java:139)
at liquibase.command.DiffCommand.createReferenceSnapshot(DiffCommand.java:190)
at liquibase.command.DiffCommand.createDiffResult(DiffCommand.java:140)
at liquibase.command.DiffToChangeLogCommand.run(DiffToChangeLogCommand.java:51)
at liquibase.command.AbstractCommand.execute(AbstractCommand.java:8)
... 4 more
Caused by: java.lang.NumberFormatException
at java.math.BigDecimal.<init>(Unknown Source)
at java.math.BigDecimal.<init>(Unknown Source)
at java.math.BigDecimal.<init>(Unknown Source)
at liquibase.util.SqlUtil.parseValue(SqlUtil.java:208)
at liquibase.snapshot.jvm.ColumnSnapshotGenerator.readDefaultValue(ColumnSnapshotGenerator.java:387)
at liquibase.snapshot.jvm.ColumnSnapshotGenerator.readColumn(ColumnSnapshotGenerator.java:223)
at liquibase.snapshot.jvm.ColumnSnapshotGenerator.addTo(ColumnSnapshotGenerator.java:115)
... 20 more
I now that NumberFormatException should contain "For input string" text. What can I do to view the message text for that exception?
Not from code, this is a compiled jar application which is run with bat file like this:
java -cp "%CP%" %JAVA_OPTS% liquibase.integration.commandline.Main %CMD_LINE_ARGS%
Caused by: java.lang.NumberFormatException
...
I now that NumberFormatException should contain "For input string" text. What can I do to view the message text for that exception?
There may not be a message for you to view. If the NumberFormatException had a detail message, it would be part of the stack trace. Here is the javadoc for NumberFormatException. You will note that there's no guarantee the exception will have a detailed message. In fact, it has a no-argument constructor which is documented to construct "a NumberFormatException with no detail message".
Additionally, here is the main constructor for the OpenJDK implementation of the BigDecimal class. If you look through it, you'll see that it throws NumberFormatExceptions with no detail message in a few places.

What is the graph format that I should pass to ArcListASCIIGraph from the Webgraph framework?

I am trying to compress a graph using the WebGraph framework. I have set up the jars I need and I use the following code:
ImmutableGraph ig = ArcListASCIIGraph.load(BoldiTest.class.getResource("/citation-csconf-mult5-PaperJSON.graph.txt").getFile());
System.out.println(ig.numNodes()+" "+ig.numArcs());
ImmutableGraph.store(BVGraph.class, ig, "output");
The graph is loaded correctly but fails to be stored for the graph I am interested. For a much smaller graph (3 arcs) everything goes well so I guess the code is correct.
I provide the Stack Trace below. Any ideas? (the numbers are nodes and arcs)
124538 249755
Exception in thread "main" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at it.unimi.dsi.big.webgraph.ImmutableGraph.store(ImmutableGraph.java:623)
at it.unimi.dsi.big.webgraph.ImmutableGraph.store(ImmutableGraph.java:638)
at gr.di.uoa.a8.boldi.BoldiTest.main(BoldiTest.java:22)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at it.unimi.dsi.big.webgraph.ImmutableGraph.store(ImmutableGraph.java:619)
... 2 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
at it.unimi.dsi.big.webgraph.BVGraph.updateBins(BVGraph.java:1701)
at it.unimi.dsi.big.webgraph.BVGraph.storeInternal(BVGraph.java:1808)
at it.unimi.dsi.big.webgraph.BVGraph.store(BVGraph.java:1650)
at it.unimi.dsi.big.webgraph.BVGraph.store(BVGraph.java:1678)
at it.unimi.dsi.big.webgraph.BVGraph.store(BVGraph.java:1690)
... 7 more
After eliminating the duplicate edges and sorting the input file I managed to store the graph.

FontFactory (lowagie), Java, getting UnsupportedEncodingException when trying to use UniJIS-UCS2-H (for Japanese)

I am using com.lowagie.text.FontFactory in generating a PDF file and am trying to use a custom font, KozMinPro-Regular, which provides support for Japanese characters, as we have a need to support this. I have found examples from searching that show how to do this similar to how I am doing it below and these examples assume that UniJIS-UCS2-H encoding is supported but when I try this I am getting the exception below that says this encoding is not supported. I would appreciate if anyone may have any insight into this. Thanks
FontFactory.register("/usr/share/fonts/truetype/KozMinPro-Regular.ttf", "JapaneseCompatible");
contentFont = FontFactory.getFont("JapaneseCompatible", "UniJIS-UCS2-H", true, 11, Font.BOLD);
headerFont = FontFactory.getFont("JapaneseCompatible", "UniJIS-UCS2-H", true, 11, Font.BOLD);
The exception I get:
Exception: [.ReportPdfView] Exception caught during generation of pdf file. Cause: UniJIS-UCS2-H
ExceptionConverter: java.io.UnsupportedEncodingException: UniJIS-UCS2-H
at java.lang.StringCoding.encode(StringCoding.java:286)
at java.lang.String.getBytes(String.java:954)
at com.lowagie.text.pdf.PdfEncodings.convertToBytes(Unknown Source)
at com.lowagie.text.pdf.TrueTypeFont.<init>(Unknown Source)
at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source)
at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source)
at com.lowagie.text.pdf.BaseFont.createFont(Unknown Source)
at com.lowagie.text.FontFactoryImp.getFont(Unknown Source)
at com.lowagie.text.FontFactoryImp.getFont(Unknown Source)
at com.lowagie.text.FontFactory.getFont(Unknown Source)
at com.lowagie.text.FontFactory.getFont(Unknown Source)
You need iTextAsian.jar . It gives CJK support.
see...
http://itextpdf.sourceforge.net/ for earlier versions of iText or
http://sourceforge.net/projects/itext/files/extrajars/ for later version of iText.(extrajars.zip contains iTextAsian.jar)

Categories

Resources