Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1
  • 2

TOPIC:

Error in some libs in 3.1beta9 9 years 5 months ago #7665

  • Felix85
  • Felix85's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 11
  • Thank you received: 0
Hi,
i have some issues with your newest libs.
On some Devices the Documents not get loaded.
And if they get loaded, they are corrupt.
Nexus7 Fails:


Samsung Galaxy Tab S this is working(sadly i cant add the picture of it, but there are pictures on both sides and from top to bottom, not like the cut version on nexus 7):

Thanks
Felix
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: by aroundmeflip.

Error in some libs in 3.1beta9 9 years 5 months ago #7672

  • nermeen
  • nermeen's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Posts: 962
  • Thank you received: 87
Did you try them with the demo project?

If you face the same problem with the demo project, can you send us a pdf to test?

Please Log in or Create an account to join the conversation.

Error in some libs in 3.1beta9 9 years 5 months ago #7674

  • Felix85
  • Felix85's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 11
  • Thank you received: 0
Sry cant do it.
Here you have a code snippet this particular sites are JPG Fileswe have some between our PDFs

Snippet:
public void setPreviewThumbnail(int i, String directory, Page p, Document d, boolean showOnlyAdPageThumbnail) {

		//normal thumbnail
		String directoryPlusThumbnail = directory + "AndroidNormal_THUMBNAIL_" + i + ".jpg";
		//check for adpage-file: thumbnail if not already downloaded
		if (p.isAdPage() && !showOnlyAdPageThumbnail){
			String temp = directory + "AndroidNormal_PDF_" + i + ".jpg";
			File file = new File(temp);
			if(file.exists()) {
				directoryPlusThumbnail = directory + "AndroidNormal_PDF_" + i + ".jpg";
				Log.d(TAG, "#adpage-file here");
			} else {
				Log.d(TAG, "#no adpage-file here");
			}
		}
		//double-page thumbnail
		String directoryPlusThumbnailDoublePage = "";
		if(p.isDoublePage()){
			directoryPlusThumbnailDoublePage = directory + "AndroidNormal_THUMBNAIL_" + (i +1) + ".jpg";
		}
		//temporary cache-files
		String tempPdf = APAWlApp.getCacheDirectory().getAbsolutePath()  + File.separator + issue.getUniqueId() + "_page_" + i + ".pdf";
		String cache = APAWlApp.getCacheDirectory().getAbsolutePath()  + File.separator + issue.getUniqueId() + "_page_" + i + "_cachefile";

		d.Create(tempPdf);
		//wichtig! cache muss gesetzt werden!
		d.SetCache(cache);

		com.radaee.pdf.Page page = null;
		if(p.isDoublePage()){
			page = d.NewPage(0, (widthThumbnail *2), heightThumbnail);//create A3 quer paper
		} else {
			page = d.NewPage(0, widthThumbnail, heightThumbnail);//create A4 paper
		}


		PageContent content = new PageContent();
		content.Create();//create content, do not forget.


		//set alpha for both fill and stroke
		DocGState dgs = d.NewGState();
		dgs.SetFillAlpha(0x80);//set alpha value to 0.5
		dgs.SetStrokeAlpha(0x80);//set alpha value to 0.5
		ResGState rgs = page.AddResGState(dgs);
		content.GSSet(rgs);

		//write a bitmap
		content.GSSave();
		dgs = d.NewGState();
		dgs.SetFillAlpha(255);//set alpha value to 1
		dgs.SetStrokeAlpha(255);//set alpha value to 1
		rgs = page.AddResGState(dgs);
		content.GSSet(rgs);

		Bitmap bit=null;

		if(!new File(directoryPlusThumbnail).exists()) {

			Log.e(TAG, "#directoryPlusThumbnail="+directoryPlusThumbnail);
			bit = Bitmap.createBitmap(50, 100, Bitmap.Config.ARGB_8888);
			Canvas canvas = new Canvas(bit);
			canvas.drawColor(0xFFFFFFFF);
		} else {
			Log.d(TAG, "#directoryPlusThumbnail="+directoryPlusThumbnail);
		}

		if(bit == null){
			if(p.isDoublePage()){

				BitmapFactory.Options options = new BitmapFactory.Options();
				options.inPurgeable = false;
				options.inPreferredConfig = Bitmap.Config.ARGB_8888;
				options.inJustDecodeBounds = false;

				//Memory-Fix fuer API-Level <2.3		
				if (android.os.Build.VERSION.SDK_INT <=  android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
					options.inSampleSize = 4;
				} else {
					options.inSampleSize = 1;
				}
				bit=combineBitmaps(BitmapFactory.decodeFile(directoryPlusThumbnail, options), BitmapFactory.decodeFile(directoryPlusThumbnailDoublePage, options));			
			} else {

				BitmapFactory.Options options = new BitmapFactory.Options();
				options.inPurgeable = false;
				options.inPreferredConfig = Bitmap.Config.ARGB_8888;
				options.inJustDecodeBounds = false;

				//Memory-Fix fuer API-Level <2.3		
				if (android.os.Build.VERSION.SDK_INT <=  android.os.Build.VERSION_CODES.GINGERBREAD_MR1) {
					options.inSampleSize = 4;
				} else {
					options.inSampleSize = 1;
				}
				bit = BitmapFactory.decodeFile(directoryPlusThumbnail, options);

			}
		}

		DocImage dimg = d.NewImage(bit, true);
		bit.recycle();
		bit = null;
		ResImage rimg = page.AddResImage(dimg);
		Matrix mat = null;
		if(p.isDoublePage()){
			mat = new Matrix( widthThumbnail *2, heightThumbnail, 0, 0 );
		} else {
			mat = new Matrix( widthThumbnail, heightThumbnail, 0, 0 );
		}

		content.GSSetMatrix(mat);
		mat.Destroy();
		content.DrawImage(rimg);
		content.GSRestore();


		//add content to page
		page.AddContent(content, true);
		content.Destroy();

		page.Close();

		//delete temporary files
		File cacheFile = new File(cache);
		File tempFile = new File(tempPdf);
		if(cacheFile.exists()) {
			cacheFile.delete();
		}
		if(tempFile.exists()) {
			tempFile.delete();
		}

	}

Please Log in or Create an account to join the conversation.

Error in some libs in 3.1beta9 9 years 5 months ago #7676

  • Felix85
  • Felix85's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 11
  • Thank you received: 0
I can tell you the rest of the picture is complete Black
Attachments:

Please Log in or Create an account to join the conversation.

Error in some libs in 3.1beta9 9 years 5 months ago #7677

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
the last beta java source codes are much changed to earliear version.
package com.radaee.pdf and com.radaee.view has much change.
so,,, both librdpdf.so and java codes need to replace.

Please Log in or Create an account to join the conversation.

Error in some libs in 3.1beta9 9 years 5 months ago #7679

  • Felix85
  • Felix85's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 11
  • Thank you received: 0
i used 3.1beta9.
I cant find any newer version.

So what do you mean with newer Version.

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Powered by Kunena Forum