]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.help.base/src/org/simantics/help/base/internal/PDFUtil.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.help.base / src / org / simantics / help / base / internal / PDFUtil.java
index 43fac6c7079a114d92e99e690824c46262967969..d0eff0550706b1877480d45fec20ae201f2bba27 100644 (file)
@@ -1,42 +1,42 @@
-package org.simantics.help.base.internal;\r
-\r
-import java.io.File;\r
-import java.io.IOException;\r
-\r
-import org.apache.pdfbox.cos.COSDocument;\r
-import org.apache.pdfbox.io.RandomAccessFile;\r
-import org.apache.pdfbox.pdfparser.PDFParser;\r
-import org.apache.pdfbox.pdmodel.PDDocument;\r
-import org.apache.pdfbox.pdmodel.PDDocumentInformation;\r
-import org.apache.pdfbox.text.PDFTextStripper;\r
-import org.eclipse.help.search.ISearchDocument;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class PDFUtil {\r
-\r
-    public static void stripText(File fromPdf, ISearchDocument doc) throws IOException {\r
-        PDFParser parser = new PDFParser(new RandomAccessFile(fromPdf, "r"));\r
-        parser.parse();\r
-\r
-        try (COSDocument cosDoc = parser.getDocument()) {\r
-            try (PDDocument pdDoc = new PDDocument(cosDoc)) {\r
-                int numPages = pdDoc.getNumberOfPages();\r
-                PDFTextStripper stripper = new PDFTextStripper();\r
-                stripper.setStartPage(1);\r
-                stripper.setEndPage(numPages);\r
-                String text = stripper.getText(pdDoc);\r
-                PDDocumentInformation docInfo = pdDoc.getDocumentInformation();\r
-                String title = docInfo.getTitle();\r
-                String subject = docInfo.getSubject();\r
-                if (title != null)\r
-                    doc.setTitle(title);\r
-                if (subject != null)\r
-                    doc.setSummary(subject);\r
-                doc.addContents(text);\r
-            }\r
-        }\r
-    }\r
-\r
+package org.simantics.help.base.internal;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.pdfbox.cos.COSDocument;
+import org.apache.pdfbox.io.RandomAccessFile;
+import org.apache.pdfbox.pdfparser.PDFParser;
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.pdmodel.PDDocumentInformation;
+import org.apache.pdfbox.text.PDFTextStripper;
+import org.eclipse.help.search.ISearchDocument;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class PDFUtil {
+
+    public static void stripText(File fromPdf, ISearchDocument doc) throws IOException {
+        PDFParser parser = new PDFParser(new RandomAccessFile(fromPdf, "r"));
+        parser.parse();
+
+        try (COSDocument cosDoc = parser.getDocument()) {
+            try (PDDocument pdDoc = new PDDocument(cosDoc)) {
+                int numPages = pdDoc.getNumberOfPages();
+                PDFTextStripper stripper = new PDFTextStripper();
+                stripper.setStartPage(1);
+                stripper.setEndPage(numPages);
+                String text = stripper.getText(pdDoc);
+                PDDocumentInformation docInfo = pdDoc.getDocumentInformation();
+                String title = docInfo.getTitle();
+                String subject = docInfo.getSubject();
+                if (title != null)
+                    doc.setTitle(title);
+                if (subject != null)
+                    doc.setSummary(subject);
+                doc.addContents(text);
+            }
+        }
+    }
+
 }
\ No newline at end of file