Java aspose.PDF platform bug

Hi there!

When “stamping” these same PDF’s with a header text, on my development PC (Linux*), everything is fine. However, when I run the same test on my production machine (IBM i Power8**), the stamp is “there” (can be selected and copied with mouse), but cannot be seen when viewed on screen.

Can you explain what I am doing wrong?

code:

	log.debug("Stamping pdf " + inputPdf.getAbsolutePath() + " with " + text);

	Color color = null;
	try {
		if (!Statics.isNullOrWhitespace(colorStr)) {
			String[] colorArr = colorStr.split(",");

			int a = 255, r = 0, g = 0, b = 0;
			if (colorArr.length == 3) {
				r = Integer.parseInt(colorArr[0]);
				g = Integer.parseInt(colorArr[1]);
				b = Integer.parseInt(colorArr[2]);
			}

			if (colorArr.length == 4) {
				a = Integer.parseInt(colorArr[3]);
			}

			color = Color.fromArgb(a, r, g, b);
		}
	} catch (Exception colorException ){
		log.warn(colorException.getLocalizedMessage());
	}

	Font font = null;
	try {
		if (!Statics.isNullOrWhitespace(fontStr)) {
			Font customFont = FontRepository.findFont(fontStr, true);
			if (customFont != null) {
				font = customFont;
			}
		}
	} catch (Exception fontException ){
		log.warn(fontException.getLocalizedMessage());
	}

	// Output file, work on output...
	FileUtils.copyFile(inputPdf, outputPdf);

	// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.Pdf-for-Java
	// open document
	Document pdfDocument = new Document(outputPdf.getAbsolutePath());

	// create page number stamp
	PageNumberStamp pageNumberStamp = new PageNumberStamp();

	// whether the stamp is background
	pageNumberStamp.setBackground(false);
	pageNumberStamp.setFormat(text);

	int padding = 5;
	pageNumberStamp.setTopMargin(padding);
	pageNumberStamp.setBottomMargin(padding);
	pageNumberStamp.setLeftMargin(padding);
	pageNumberStamp.setRightMargin(padding);

	pageNumberStamp.setHorizontalAlignment(HorizontalAlignment.Left);
	pageNumberStamp.setVerticalAlignment(VerticalAlignment.Top);
	pageNumberStamp.setStartingNumber(1);

	// set text properties
	if (font != null) {
		pageNumberStamp.getTextState().setFont(font);
	}

	if (color != null) {
		pageNumberStamp.getTextState().setForegroundColor(color);
	}

	pageNumberStamp.getTextState().setFontSize(12.0F);
	pageNumberStamp.getTextState().setFontStyle(FontStyles.Bold);

	// add stamp to particular page
	pdfDocument.getPages().get_Item(1).addStamp(pageNumberStamp);

	pdfDocument.getInfo().setTitle(text);

	pdfDocument.getMetadata().addItem("xmp:KTP-ORIGINAL-FILE-" + Statics.getTimestamp(), inputPdf.getAbsolutePath());
	pdfDocument.getMetadata().addItem("xmp:KTP-STAMP-TEXT-" + Statics.getTimestamp(), text);

	// save output document
	pdfDocument.save();

Files…

Scan0145.pdf (304.4 KB)

ok-Scan0145.pdf (306.7 KB)

Fail-Scan0145.pdf (352.0 KB)

*1, Fedora Linux, F27:
java -version
openjdk version “1.8.0_151”
OpenJDK Runtime Environment (build 1.8.0_151-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

*2 IBM i Power 8, OS/400 7.3:
java -version
java version “1.8.0”
Java™ SE Runtime Environment (build pap6480sr4fp10-20170727_01(SR4 FP10))
IBM J9 VM (build 2.8, JRE 1.8.0 OS/400 ppc64-64 Compressed References jvmap6480sr4fp10-20170727_01_cr (JIT enabled, AOT enabled)
J9VM - R28_20170722_0201_B357405
JIT - tr.r14.java_20170722_357405
GC - R28_20170722_0201_B357405_CMPRSS
J9CL - 20170722_357405)
JCL - 20170726_01 based on Oracle jdk8u144-b01

@jens.churchill

Thank you for contacting support.

I would like to request you to to upload the attached files once again, because these three PDF files are not being downloaded. Kindly zip the files and share with us. Please ensure using Aspose.Pdf for Java 17.11 in your environment before you share the requested data with us.