本文整理汇总了Java中com.shockwave.pdfium.PdfDocument类的典型用法代码示例。如果您正苦于以下问题:Java PdfDocument类的具体用法?Java PdfDocument怎么用?Java PdfDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PdfDocument类属于com.shockwave.pdfium包,在下文中一共展示了PdfDocument类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkLinkTapped
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
private boolean checkLinkTapped(float x, float y) {
PdfFile pdfFile = pdfView.pdfFile;
float mappedX = -pdfView.getCurrentXOffset() + x;
float mappedY = -pdfView.getCurrentYOffset() + y;
int page = pdfFile.getPageAtOffset(pdfView.isSwipeVertical() ? mappedY : mappedX, pdfView.getZoom());
SizeF pageSize = pdfFile.getScaledPageSize(page, pdfView.getZoom());
int pageX, pageY;
if (pdfView.isSwipeVertical()) {
pageX = (int) pdfFile.getSecondaryPageOffset(page, pdfView.getZoom());
pageY = (int) pdfFile.getPageOffset(page, pdfView.getZoom());
} else {
pageY = (int) pdfFile.getSecondaryPageOffset(page, pdfView.getZoom());
pageX = (int) pdfFile.getPageOffset(page, pdfView.getZoom());
}
for (PdfDocument.Link link : pdfFile.getPageLinks(page)) {
RectF mapped = pdfFile.mapRectToDevice(page, pageX, pageY, (int) pageSize.getWidth(),
(int) pageSize.getHeight(), link.getBounds());
fixCoords(mapped);
if (mapped.contains(mappedX, mappedY)) {
pdfView.callbacks.callLinkHandler(new LinkTapEvent(x, y, mappedX, mappedY, mapped, link));
return true;
}
}
return false;
}
开发者ID:barteksc,项目名称:AndroidPdfViewer,代码行数:26,代码来源:DragPinchManager.java
示例2: loadComplete
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
@Override
public void loadComplete(int nbPages) {
isLoadComPlete = true;
PdfDocument.Meta meta = mPdfView.getDocumentMeta();
LogUtils.d("pdf title = " + meta.getTitle());
LogUtils.d(TAG+"author = " + meta.getAuthor());
LogUtils.d(TAG+"subject = " + meta.getSubject());
LogUtils.d(TAG+"keywords = " + meta.getKeywords());
LogUtils.d(TAG+"creator = " + meta.getCreator());
LogUtils.d(TAG+ "producer = " + meta.getProducer());
LogUtils.d(TAG+"creationDate = " + meta.getCreationDate());
LogUtils.d(TAG+ "modDate = " + meta.getModDate());
}
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:14,代码来源:PdfPreviewActivity.java
示例3: loadComplete
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
/**
* Called when the PDF is loaded
*/
void loadComplete(PdfDocument pdfDocument, int pageWidth, int pageHeight) {
state = State.LOADED;
this.documentPageCount = pdfiumCore.getPageCount(pdfDocument);
this.pdfDocument = pdfDocument;
this.pageWidth = pageWidth;
this.pageHeight = pageHeight;
calculateOptimalWidthAndHeight();
pagesLoader = new PagesLoader(this);
if (!renderingHandlerThread.isAlive()) {
renderingHandlerThread.start();
}
renderingHandler = new RenderingHandler(renderingHandlerThread.getLooper(),
this, pdfiumCore, pdfDocument);
renderingHandler.start();
if (scrollHandle != null) {
scrollHandle.setupLayout(this);
isScrollHandleInit = true;
}
if (onLoadCompleteListener != null) {
onLoadCompleteListener.loadComplete(documentPageCount);
}
jumpTo(defaultPage, false);
}
开发者ID:barteksc,项目名称:AndroidPdfViewerV2,代码行数:34,代码来源:PDFView.java
示例4: loadComplete
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
@Override
public void loadComplete(int nbPages) {
PdfDocument.Meta meta = pdfView.getDocumentMeta();
Log.e(TAG, "title = " + meta.getTitle());
Log.e(TAG, "author = " + meta.getAuthor());
Log.e(TAG, "subject = " + meta.getSubject());
Log.e(TAG, "keywords = " + meta.getKeywords());
Log.e(TAG, "creator = " + meta.getCreator());
Log.e(TAG, "producer = " + meta.getProducer());
Log.e(TAG, "creationDate = " + meta.getCreationDate());
Log.e(TAG, "modDate = " + meta.getModDate());
printBookmarksTree(pdfView.getTableOfContents(), "-");
}
开发者ID:barteksc,项目名称:AndroidPdfViewerV2,代码行数:16,代码来源:PDFViewActivity.java
示例5: printBookmarksTree
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
public void printBookmarksTree(List<PdfDocument.Bookmark> tree, String sep) {
for (PdfDocument.Bookmark b : tree) {
Log.e(TAG, String.format("%s %s, p %d", sep, b.getTitle(), b.getPageIdx()));
if (b.hasChildren()) {
printBookmarksTree(b.getChildren(), sep + "-");
}
}
}
开发者ID:barteksc,项目名称:AndroidPdfViewerV2,代码行数:11,代码来源:PDFViewActivity.java
示例6: readPdfMetadata
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
private void readPdfMetadata(final String filename, final File f, final EBook ebk) {
ebk.addFileType("pdf");
ebk.setBook_title(f.getName().substring(0, f.getName().length() - 4));
ebk.setFull_file_dir_name(ebk.getFile_dir() + File.separator + ebk.getBook_title());
try {
final ParcelFileDescriptor fileDesc = ParcelFileDescriptor.open(new File(filename), ParcelFileDescriptor.MODE_READ_ONLY);
PdfDocument pdfDocument = pdfiumCore.newDocument(fileDesc);
PdfDocument.Meta meta = pdfiumCore.getDocumentMeta(pdfDocument);
pdfiumCore.openPage(pdfDocument, 0);
int width = pdfiumCore.getPageWidthPoint(pdfDocument, pageNum);
int height = pdfiumCore.getPageHeightPoint(pdfDocument, pageNum);
Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
pdfiumCore.renderPageBitmap(pdfDocument, bmp, pageNum, 0, 0, width, height);
ebk.setCoverImageFromBitmap(bmp);
String pdfTitle = meta.getTitle().trim();
if (pdfTitle.length() > 0 && !pdfTitle.toLowerCase().equals("untitled")) {
ebk.setBook_title(pdfTitle);
}
ebk.addAuthor(new Author(meta.getAuthor()));
pdfiumCore.closeDocument(pdfDocument);
} catch (FileNotFoundException e) {
BookLibApplication.e(LOG_TAG + "FileNotFoundException reading pdf file [" + filename + "] " + e.getMessage());
} catch (IOException e1) {
BookLibApplication.e(LOG_TAG + "IOException reading pdf file [" + filename + "] " + e1.getMessage());
}
}
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:30,代码来源:LibraryScanner.java
示例7: printPdfInfo
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
public void printPdfInfo(final PdfiumCore core, final PdfDocument doc) {
PdfDocument.Meta meta = core.getDocumentMeta(doc);
BookLibApplication.e(LOG_TAG + "title = " + meta.getTitle());
BookLibApplication.e(LOG_TAG + "author = " + meta.getAuthor());
BookLibApplication.e(LOG_TAG + "subject = " + meta.getSubject());
BookLibApplication.e(LOG_TAG + "keywords = " + meta.getKeywords());
BookLibApplication.e(LOG_TAG + "creator = " + meta.getCreator());
BookLibApplication.e(LOG_TAG + "producer = " + meta.getProducer());
BookLibApplication.e(LOG_TAG + "creationDate = " + meta.getCreationDate());
BookLibApplication.e(LOG_TAG + "modDate = " + meta.getModDate());
}
开发者ID:mrspaceman,项目名称:ebookmgr,代码行数:12,代码来源:LibraryScanner.java
示例8: RenderingAsyncTask
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
public RenderingAsyncTask(PDFView pdfView, PdfiumCore pdfiumCore, PdfDocument pdfDocument) {
this.pdfView = pdfView;
this.pdfiumCore = pdfiumCore;
this.pdfDocument = pdfDocument;
this.renderingTasks = Collections.synchronizedList(new ArrayList<RenderingTask>());
}
开发者ID:bramach5,项目名称:Bala-PdfViewer-with-Voice,代码行数:8,代码来源:RenderingAsyncTask.java
示例9: loadComplete
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
/**
* Called when the PDF is loaded
*/
public void loadComplete(PdfDocument pdfDocument) {
state = State.LOADED;
this.documentPageCount = pdfiumCore.getPageCount(pdfDocument);
int firstPageIdx = 0;
if (originalUserPages != null) {
firstPageIdx = originalUserPages[0];
}
// We assume all the pages are the same size
this.pdfDocument = pdfDocument;
pdfiumCore.openPage(pdfDocument, firstPageIdx);
this.pageWidth = pdfiumCore.getPageWidth(pdfDocument, firstPageIdx);
this.pageHeight = pdfiumCore.getPageHeight(pdfDocument, firstPageIdx);
calculateOptimalWidthAndHeight();
pagesLoader = new PagesLoader(this);
renderingAsyncTask = new RenderingAsyncTask(this, pdfiumCore, pdfDocument);
renderingAsyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
if (scrollHandle != null) {
scrollHandle.setupLayout(this);
isScrollHandleInit = true;
}
// Notify the listener
jumpTo(defaultPage, false);
if (onLoadCompleteListener != null) {
onLoadCompleteListener.loadComplete(documentPageCount);
}
}
开发者ID:bramach5,项目名称:Bala-PdfViewer-with-Voice,代码行数:36,代码来源:PDFView.java
示例10: loadComplete
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
/**
* Called when the PDF is loaded
*/
public void loadComplete(PdfDocument pdfDocument) {
this.documentPageCount = pdfiumCore.getPageCount(pdfDocument);
int firstPageIdx = 0;
if (originalUserPages != null) {
firstPageIdx = originalUserPages[0];
}
// We assume all the pages are the same size
this.pdfDocument = pdfDocument;
pdfiumCore.openPage(pdfDocument, firstPageIdx);
openedPages.add(firstPageIdx);
this.pageWidth = pdfiumCore.getPageWidth(pdfDocument, firstPageIdx);
this.pageHeight = pdfiumCore.getPageHeight(pdfDocument, firstPageIdx);
state = State.LOADED;
calculateOptimalWidthAndHeight();
if (!renderingHandlerThread.isAlive()) {
renderingHandlerThread.start();
}
renderingHandler = new RenderingHandler(renderingHandlerThread.getLooper(),
this, pdfiumCore, pdfDocument);
if (scrollBar != null) {
scrollBar.pdfLoaded();
}
// Notify the listener
jumpTo(defaultPage);
if (onLoadCompleteListener != null) {
onLoadCompleteListener.loadComplete(documentPageCount);
}
}
开发者ID:barteksc,项目名称:AndroidPdfViewerV1,代码行数:37,代码来源:PDFView.java
示例11: getDocumentMeta
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
/** Returns null if document is not loaded */
public PdfDocument.Meta getDocumentMeta() {
if (pdfFile == null) {
return null;
}
return pdfFile.getMetaData();
}
开发者ID:barteksc,项目名称:AndroidPdfViewer,代码行数:8,代码来源:PDFView.java
示例12: getTableOfContents
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
/** Will be empty until document is loaded */
public List<PdfDocument.Bookmark> getTableOfContents() {
if (pdfFile == null) {
return Collections.emptyList();
}
return pdfFile.getBookmarks();
}
开发者ID:barteksc,项目名称:AndroidPdfViewer,代码行数:8,代码来源:PDFView.java
示例13: getLinks
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
/** Will be empty until document is loaded */
public List<PdfDocument.Link> getLinks(int page) {
if (pdfFile == null) {
return Collections.emptyList();
}
return pdfFile.getPageLinks(page);
}
开发者ID:barteksc,项目名称:AndroidPdfViewer,代码行数:8,代码来源:PDFView.java
示例14: PdfFile
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
PdfFile(PdfiumCore pdfiumCore, PdfDocument pdfDocument, FitPolicy pageFitPolicy, Size viewSize, int[] originalUserPages,
boolean isVertical, int spacing) {
this.pdfiumCore = pdfiumCore;
this.pdfDocument = pdfDocument;
this.pageFitPolicy = pageFitPolicy;
this.originalUserPages = originalUserPages;
this.isVertical = isVertical;
this.spacingPx = spacing;
setup(viewSize);
}
开发者ID:barteksc,项目名称:AndroidPdfViewer,代码行数:11,代码来源:PdfFile.java
示例15: LinkTapEvent
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
public LinkTapEvent(float originalX, float originalY, float documentX, float documentY, RectF mappedLinkRect, PdfDocument.Link link) {
this.originalX = originalX;
this.originalY = originalY;
this.documentX = documentX;
this.documentY = documentY;
this.mappedLinkRect = mappedLinkRect;
this.link = link;
}
开发者ID:barteksc,项目名称:AndroidPdfViewer,代码行数:9,代码来源:LinkTapEvent.java
示例16: doInBackground
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
@Override
protected Throwable doInBackground(Void... params) {
try {
PdfDocument pdfDocument = docSource.createDocument(pdfView.getContext(), pdfiumCore, password);
pdfFile = new PdfFile(pdfiumCore, pdfDocument, pdfView.getPageFitPolicy(), getViewSize(),
userPages, pdfView.isSwipeVertical(), pdfView.getSpacingPx());
return null;
} catch (Throwable t) {
return t;
}
}
开发者ID:barteksc,项目名称:AndroidPdfViewer,代码行数:12,代码来源:DecodingAsyncTask.java
示例17: getDocumentMeta
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
public PdfDocument.Meta getDocumentMeta() {
if (pdfDocument == null) {
return null;
}
return pdfiumCore.getDocumentMeta(pdfDocument);
}
开发者ID:barteksc,项目名称:AndroidPdfViewerV2,代码行数:7,代码来源:PDFView.java
示例18: getTableOfContents
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
public List<PdfDocument.Bookmark> getTableOfContents() {
if (pdfDocument == null) {
return new ArrayList<>();
}
return pdfiumCore.getTableOfContents(pdfDocument);
}
开发者ID:barteksc,项目名称:AndroidPdfViewerV2,代码行数:7,代码来源:PDFView.java
示例19: RenderingHandler
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
RenderingHandler(Looper looper, PDFView pdfView, PdfiumCore pdfiumCore, PdfDocument pdfDocument) {
super(looper);
this.pdfView = pdfView;
this.pdfiumCore = pdfiumCore;
this.pdfDocument = pdfDocument;
}
开发者ID:barteksc,项目名称:AndroidPdfViewerV2,代码行数:7,代码来源:RenderingHandler.java
示例20: createDocument
import com.shockwave.pdfium.PdfDocument; //导入依赖的package包/类
@Override
public PdfDocument createDocument(Context context, PdfiumCore core, String password) throws IOException {
ParcelFileDescriptor pfd = context.getContentResolver().openFileDescriptor(uri, "r");
return core.newDocument(pfd, password);
}
开发者ID:barteksc,项目名称:AndroidPdfViewerV2,代码行数:6,代码来源:UriSource.java
注:本文中的com.shockwave.pdfium.PdfDocument类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论