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

The following examples show how to use com.lowagie.text.pdf.PdfWriter#PageLayoutSinglePage . 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
/**
 * Adds the viewer preferences defined in the preferences parameter to a
 * PdfDictionary (more specifically the root or catalog of a PDF file).
 * 
 * @param catalog
 */
public void addToCatalog(PdfDictionary catalog) {
	// Page Layout
	catalog.remove(PdfName.PAGELAYOUT);
	if ((pageLayoutAndMode & PdfWriter.PageLayoutSinglePage) != 0)
		catalog.put(PdfName.PAGELAYOUT, PdfName.SINGLEPAGE);
	else if ((pageLayoutAndMode & PdfWriter.PageLayoutOneColumn) != 0)
		catalog.put(PdfName.PAGELAYOUT, PdfName.ONECOLUMN);
	else if ((pageLayoutAndMode & PdfWriter.PageLayoutTwoColumnLeft) != 0)
		catalog.put(PdfName.PAGELAYOUT, PdfName.TWOCOLUMNLEFT);
	else if ((pageLayoutAndMode & PdfWriter.PageLayoutTwoColumnRight) != 0)
		catalog.put(PdfName.PAGELAYOUT, PdfName.TWOCOLUMNRIGHT);
	else if ((pageLayoutAndMode & PdfWriter.PageLayoutTwoPageLeft) != 0)
		catalog.put(PdfName.PAGELAYOUT, PdfName.TWOPAGELEFT);
	else if ((pageLayoutAndMode & PdfWriter.PageLayoutTwoPageRight) != 0)
		catalog.put(PdfName.PAGELAYOUT, PdfName.TWOPAGERIGHT);

	// Page Mode
	catalog.remove(PdfName.PAGEMODE);
	if ((pageLayoutAndMode & PdfWriter.PageModeUseNone) != 0)
		catalog.put(PdfName.PAGEMODE, PdfName.USENONE);
	else if ((pageLayoutAndMode & PdfWriter.PageModeUseOutlines) != 0)
		catalog.put(PdfName.PAGEMODE, PdfName.USEOUTLINES);
	else if ((pageLayoutAndMode & PdfWriter.PageModeUseThumbs) != 0)
		catalog.put(PdfName.PAGEMODE, PdfName.USETHUMBS);
	else if ((pageLayoutAndMode & PdfWriter.PageModeFullScreen) != 0)
		catalog.put(PdfName.PAGEMODE, PdfName.FULLSCREEN);
	else if ((pageLayoutAndMode & PdfWriter.PageModeUseOC) != 0)
		catalog.put(PdfName.PAGEMODE, PdfName.USEOC);
	else if ((pageLayoutAndMode & PdfWriter.PageModeUseAttachments) != 0)
		catalog.put(PdfName.PAGEMODE, PdfName.USEATTACHMENTS);

	// viewer preferences (Table 8.1 of the PDF Reference)
	catalog.remove(PdfName.VIEWERPREFERENCES);
	if (viewerPreferences.size() > 0) {
		catalog.put(PdfName.VIEWERPREFERENCES, viewerPreferences);
	}
}
 
Example 2
Source File: PdfViewerPreferencesImp.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Adds the viewer preferences defined in the preferences parameter to a
 * PdfDictionary (more specifically the root or catalog of a PDF file).
 * 
 * @param catalog
 */
public void addToCatalog(PdfDictionary catalog) {
	// Page Layout
	catalog.remove(PdfName.PAGELAYOUT);
	if ((pageLayoutAndMode & PdfWriter.PageLayoutSinglePage) != 0)
		catalog.put(PdfName.PAGELAYOUT, PdfName.SINGLEPAGE);
	else if ((pageLayoutAndMode & PdfWriter.PageLayoutOneColumn) != 0)
		catalog.put(PdfName.PAGELAYOUT, PdfName.ONECOLUMN);
	else if ((pageLayoutAndMode & PdfWriter.PageLayoutTwoColumnLeft) != 0)
		catalog.put(PdfName.PAGELAYOUT, PdfName.TWOCOLUMNLEFT);
	else if ((pageLayoutAndMode & PdfWriter.PageLayoutTwoColumnRight) != 0)
		catalog.put(PdfName.PAGELAYOUT, PdfName.TWOCOLUMNRIGHT);
	else if ((pageLayoutAndMode & PdfWriter.PageLayoutTwoPageLeft) != 0)
		catalog.put(PdfName.PAGELAYOUT, PdfName.TWOPAGELEFT);
	else if ((pageLayoutAndMode & PdfWriter.PageLayoutTwoPageRight) != 0)
		catalog.put(PdfName.PAGELAYOUT, PdfName.TWOPAGERIGHT);

	// Page Mode
	catalog.remove(PdfName.PAGEMODE);
	if ((pageLayoutAndMode & PdfWriter.PageModeUseNone) != 0)
		catalog.put(PdfName.PAGEMODE, PdfName.USENONE);
	else if ((pageLayoutAndMode & PdfWriter.PageModeUseOutlines) != 0)
		catalog.put(PdfName.PAGEMODE, PdfName.USEOUTLINES);
	else if ((pageLayoutAndMode & PdfWriter.PageModeUseThumbs) != 0)
		catalog.put(PdfName.PAGEMODE, PdfName.USETHUMBS);
	else if ((pageLayoutAndMode & PdfWriter.PageModeFullScreen) != 0)
		catalog.put(PdfName.PAGEMODE, PdfName.FULLSCREEN);
	else if ((pageLayoutAndMode & PdfWriter.PageModeUseOC) != 0)
		catalog.put(PdfName.PAGEMODE, PdfName.USEOC);
	else if ((pageLayoutAndMode & PdfWriter.PageModeUseAttachments) != 0)
		catalog.put(PdfName.PAGEMODE, PdfName.USEATTACHMENTS);

	// viewer preferences (Table 8.1 of the PDF Reference)
	catalog.remove(PdfName.VIEWERPREFERENCES);
	if (viewerPreferences.size() > 0) {
		catalog.put(PdfName.VIEWERPREFERENCES, viewerPreferences);
	}
}
 
Example 3
Source File: AbstractPdfView.java    From spring-analysis-note with MIT License 2 votes vote down vote up
/**
 * Return the viewer preferences for the PDF file.
 * <p>By default returns {@code AllowPrinting} and
 * {@code PageLayoutSinglePage}, but can be subclassed.
 * The subclass can either have fixed preferences or retrieve
 * them from bean properties defined on the View.
 * @return an int containing the bits information against PdfWriter definitions
 * @see com.lowagie.text.pdf.PdfWriter#AllowPrinting
 * @see com.lowagie.text.pdf.PdfWriter#PageLayoutSinglePage
 */
protected int getViewerPreferences() {
	return PdfWriter.ALLOW_PRINTING | PdfWriter.PageLayoutSinglePage;
}
 
Example 4
Source File: AbstractPdfView.java    From java-technology-stack with MIT License 2 votes vote down vote up
/**
 * Return the viewer preferences for the PDF file.
 * <p>By default returns {@code AllowPrinting} and
 * {@code PageLayoutSinglePage}, but can be subclassed.
 * The subclass can either have fixed preferences or retrieve
 * them from bean properties defined on the View.
 * @return an int containing the bits information against PdfWriter definitions
 * @see com.lowagie.text.pdf.PdfWriter#AllowPrinting
 * @see com.lowagie.text.pdf.PdfWriter#PageLayoutSinglePage
 */
protected int getViewerPreferences() {
	return PdfWriter.ALLOW_PRINTING | PdfWriter.PageLayoutSinglePage;
}
 
Example 5
Source File: AbstractPdfView.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Return the viewer preferences for the PDF file.
 * <p>By default returns {@code AllowPrinting} and
 * {@code PageLayoutSinglePage}, but can be subclassed.
 * The subclass can either have fixed preferences or retrieve
 * them from bean properties defined on the View.
 * @return an int containing the bits information against PdfWriter definitions
 * @see com.lowagie.text.pdf.PdfWriter#AllowPrinting
 * @see com.lowagie.text.pdf.PdfWriter#PageLayoutSinglePage
 */
protected int getViewerPreferences() {
	return PdfWriter.ALLOW_PRINTING | PdfWriter.PageLayoutSinglePage;
}
 
Example 6
Source File: AbstractPdfView.java    From spring4-understanding with Apache License 2.0 2 votes vote down vote up
/**
 * Return the viewer preferences for the PDF file.
 * <p>By default returns {@code AllowPrinting} and
 * {@code PageLayoutSinglePage}, but can be subclassed.
 * The subclass can either have fixed preferences or retrieve
 * them from bean properties defined on the View.
 * @return an int containing the bits information against PdfWriter definitions
 * @see com.lowagie.text.pdf.PdfWriter#AllowPrinting
 * @see com.lowagie.text.pdf.PdfWriter#PageLayoutSinglePage
 */
protected int getViewerPreferences() {
	return PdfWriter.ALLOW_PRINTING | PdfWriter.PageLayoutSinglePage;
}