PDF to png on Android
Posted: 2016-04-18T12:57:04-07:00
Folks
Can someone show me what api at C should I use to convert PDF to PNG? Must perform this conversion on android and am having trouble for it.
Follow my attempt:
I need to set the density and I'm having trouble...... I'm on the correct track?
tks
Can someone show me what api at C should I use to convert PDF to PNG? Must perform this conversion on android and am having trouble for it.
Follow my attempt:
Code: Select all
JNIEXPORT void JNICALL Java_magick_Pdf_pdfToPng
(JNIEnv *env, jobject self)
{
printf("Hello World!\n");
int args_count;
char *args[] = { "convert", "-density", "300", "/storage/emulated/0/files/pdftopng.pdf",
"/storage/emulated/0/files/pdftopng.png"};
for(args_count = 0; args[args_count] != (char *)NULL; args_count++);
ImageInfo *image_info = AcquireImageInfo();
ExceptionInfo *exception = AcquireExceptionInfo();
MagickBooleanType status =
ConvertImageCommand(image_info, args_count, args, NULL, exception);
if (exception->severity != UndefinedException)
{
status=MagickTrue;
CatchException(exception);
}
if (status == MagickFalse)
fprintf(stderr, "Error in call\n");
image_info=DestroyImageInfo(image_info);
exception=DestroyExceptionInfo(exception);
}
tks