RadaeePDF.com :: Topic: Error in some libs in 3.1beta9 (1/2)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF
  • Page:
  • 1
  • 2

TOPIC: Error in some libs in 3.1beta9

Error in some libs in 3.1beta9 2 years 10 months ago #7665

  • Felix85
  • Felix85's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 11
  • Karma: 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:
Wrong.png

WrongDevice.png

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):
WorkingDevice.png

Thanks
Felix
Last Edit: 2 years 10 months ago by aroundmeflip.
The administrator has disabled public write access.

Error in some libs in 3.1beta9 2 years 10 months ago #7672

  • nermeen
  • nermeen's Avatar
  • OFFLINE
  • Moderator
  • Posts: 683
  • Thank you received: 40
  • Karma: 18
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?
The administrator has disabled public write access.

Error in some libs in 3.1beta9 2 years 10 months ago #7674

  • Felix85
  • Felix85's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 11
  • Karma: 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();
		}

	}
The administrator has disabled public write access.

Error in some libs in 3.1beta9 2 years 10 months ago #7676

  • Felix85
  • Felix85's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 11
  • Karma: 0
I can tell you the rest of the picture is complete Black
AndroidNormal_PDF_6.jpg
The administrator has disabled public write access.

Error in some libs in 3.1beta9 2 years 10 months ago #7677

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
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.
The administrator has disabled public write access.

Error in some libs in 3.1beta9 2 years 10 months ago #7679

  • Felix85
  • Felix85's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 11
  • Karma: 0
i used 3.1beta9.
I cant find any newer version.

So what do you mean with newer Version.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Powered by Kunena Forum