MCPcopy Index your code
hub / github.com/apache/pdfbox / call

Method call

tools/src/main/java/org/apache/pdfbox/tools/PDFToImage.java:120–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

118 }
119
120 public Integer call()
121 {
122 if (outputPrefix == null)
123 {
124 outputPrefix = FilenameUtils.removeExtension(infile.getAbsolutePath());
125 }
126
127 List<String> writerFormatNames = Arrays.asList(ImageIO.getWriterFormatNames());
128 if (!writerFormatNames.contains(imageFormat))
129 {
130 String wfn = writerFormatNames.stream().collect(Collectors.joining(", "));
131 SYSERR.println("Error: Invalid image format " + imageFormat + " - supported formats: " +
132 wfn);
133 return 2;
134 }
135
136 if (quality < 0)
137 {
138 quality = "png".equals(imageFormat) ? 0f : 1f;
139 }
140
141 if (dpi == 0)
142 {
143 try
144 {
145 dpi = Toolkit.getDefaultToolkit().getScreenResolution();
146 }
147 catch (HeadlessException e)
148 {
149 dpi = 96;
150 }
151 }
152
153 try (PDDocument document = Loader.loadPDF(infile, password))
154 {
155 PDAcroForm acroForm = document.getDocumentCatalog().getAcroForm();
156 if (acroForm != null && acroForm.getNeedAppearances())
157 {
158 acroForm.refreshAppearances();
159 }
160
161 if (cropbox != null)
162 {
163 changeCropBox(document, cropbox[0], cropbox[1], cropbox[2], cropbox[3]);
164 }
165
166 long startTime = System.nanoTime();
167
168 // render the pages
169 if (page != -1)
170 {
171 startPage = page;
172 endPage = page;
173 }
174 boolean success = true;
175 endPage = Math.min(endPage, document.getNumberOfPages());
176 PDFRenderer renderer = new PDFRenderer(document);
177 renderer.setSubsamplingAllowed(subsampling);

Callers

nothing calls this directly

Calls 13

loadPDFMethod · 0.95
getNeedAppearancesMethod · 0.95
refreshAppearancesMethod · 0.95
changeCropBoxMethod · 0.95
setSubsamplingAllowedMethod · 0.95
renderImageWithDPIMethod · 0.95
writeImageMethod · 0.95
collectMethod · 0.80
getDocumentCatalogMethod · 0.80
containsMethod · 0.45
equalsMethod · 0.45
getAcroFormMethod · 0.45

Tested by

no test coverage detected