Java Code Examples for com.lowagie.text.pdf.PdfWriter#PrintScalingNone

The following examples show how to use com.lowagie.text.pdf.PdfWriter#PrintScalingNone . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PdfViewerPreferencesImp.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Sets the viewer preferences as the sum of several constants.
 * 
 * @param preferences
 *            the viewer preferences
 * @see PdfViewerPreferences#setViewerPreferences
 */
public void setViewerPreferences(int preferences) {
	this.pageLayoutAndMode |= preferences;
	// for backwards compatibility, it is also possible
	// to set the following viewer preferences with this method:
	if ((preferences & viewerPreferencesMask) != 0) {
		pageLayoutAndMode = ~viewerPreferencesMask & pageLayoutAndMode;
		if ((preferences & PdfWriter.HideToolbar) != 0)
			viewerPreferences.put(PdfName.HIDETOOLBAR, PdfBoolean.PDFTRUE);
		if ((preferences & PdfWriter.HideMenubar) != 0)
			viewerPreferences.put(PdfName.HIDEMENUBAR, PdfBoolean.PDFTRUE);
		if ((preferences & PdfWriter.HideWindowUI) != 0)
			viewerPreferences.put(PdfName.HIDEWINDOWUI, PdfBoolean.PDFTRUE);
		if ((preferences & PdfWriter.FitWindow) != 0)
			viewerPreferences.put(PdfName.FITWINDOW, PdfBoolean.PDFTRUE);
		if ((preferences & PdfWriter.CenterWindow) != 0)
			viewerPreferences.put(PdfName.CENTERWINDOW, PdfBoolean.PDFTRUE);
		if ((preferences & PdfWriter.DisplayDocTitle) != 0)
			viewerPreferences.put(PdfName.DISPLAYDOCTITLE, PdfBoolean.PDFTRUE);
		
		if ((preferences & PdfWriter.NonFullScreenPageModeUseNone) != 0)
			viewerPreferences.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USENONE);
		else if ((preferences & PdfWriter.NonFullScreenPageModeUseOutlines) != 0)
			viewerPreferences.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USEOUTLINES);
		else if ((preferences & PdfWriter.NonFullScreenPageModeUseThumbs) != 0)
			viewerPreferences.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USETHUMBS);
		else if ((preferences & PdfWriter.NonFullScreenPageModeUseOC) != 0)
			viewerPreferences.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USEOC);

		if ((preferences & PdfWriter.DirectionL2R) != 0)
			viewerPreferences.put(PdfName.DIRECTION, PdfName.L2R);
		else if ((preferences & PdfWriter.DirectionR2L) != 0)
			viewerPreferences.put(PdfName.DIRECTION, PdfName.R2L);

		if ((preferences & PdfWriter.PrintScalingNone) != 0)
			viewerPreferences.put(PdfName.PRINTSCALING, PdfName.NONE);			
	}
}
 
Example 2
Source File: PdfViewerPreferencesImp.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Sets the viewer preferences as the sum of several constants.
 * 
 * @param preferences
 *            the viewer preferences
 * @see PdfViewerPreferences#setViewerPreferences
 */
public void setViewerPreferences(int preferences) {
	this.pageLayoutAndMode |= preferences;
	// for backwards compatibility, it is also possible
	// to set the following viewer preferences with this method:
	if ((preferences & viewerPreferencesMask) != 0) {
		pageLayoutAndMode = ~viewerPreferencesMask & pageLayoutAndMode;
		if ((preferences & PdfWriter.HideToolbar) != 0)
			viewerPreferences.put(PdfName.HIDETOOLBAR, PdfBoolean.PDFTRUE);
		if ((preferences & PdfWriter.HideMenubar) != 0)
			viewerPreferences.put(PdfName.HIDEMENUBAR, PdfBoolean.PDFTRUE);
		if ((preferences & PdfWriter.HideWindowUI) != 0)
			viewerPreferences.put(PdfName.HIDEWINDOWUI, PdfBoolean.PDFTRUE);
		if ((preferences & PdfWriter.FitWindow) != 0)
			viewerPreferences.put(PdfName.FITWINDOW, PdfBoolean.PDFTRUE);
		if ((preferences & PdfWriter.CenterWindow) != 0)
			viewerPreferences.put(PdfName.CENTERWINDOW, PdfBoolean.PDFTRUE);
		if ((preferences & PdfWriter.DisplayDocTitle) != 0)
			viewerPreferences.put(PdfName.DISPLAYDOCTITLE, PdfBoolean.PDFTRUE);
		
		if ((preferences & PdfWriter.NonFullScreenPageModeUseNone) != 0)
			viewerPreferences.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USENONE);
		else if ((preferences & PdfWriter.NonFullScreenPageModeUseOutlines) != 0)
			viewerPreferences.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USEOUTLINES);
		else if ((preferences & PdfWriter.NonFullScreenPageModeUseThumbs) != 0)
			viewerPreferences.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USETHUMBS);
		else if ((preferences & PdfWriter.NonFullScreenPageModeUseOC) != 0)
			viewerPreferences.put(PdfName.NONFULLSCREENPAGEMODE, PdfName.USEOC);

		if ((preferences & PdfWriter.DirectionL2R) != 0)
			viewerPreferences.put(PdfName.DIRECTION, PdfName.L2R);
		else if ((preferences & PdfWriter.DirectionR2L) != 0)
			viewerPreferences.put(PdfName.DIRECTION, PdfName.R2L);

		if ((preferences & PdfWriter.PrintScalingNone) != 0)
			viewerPreferences.put(PdfName.PRINTSCALING, PdfName.NONE);			
	}
}