Sorry for the badly-formatted question, It’s my first time posting here.
I am trying to display the pdf by converting it to png first & using SDL2 to show it. But when I add my asposePDF code to convert from pdf to png & run it, I get LNK 2019 ‘unresolved external’ errors. I’ll show the full errors in the picture since they’re quite long.
errors.png (32.9 KB)
I have added the CodePortingTranslator, so that’s not the issue. Also, I seem to have the necessary headers for my code: //SDL2 headers #include <SDL.h> #include <SDL_image.h> //asposePDF headers #include <Aspose.PDF.Cpp/Document.h> #include <Aspose.PDF.Cpp/Page.h> #include <Aspose.PDF.Cpp/Devices/PngDevice.h> #include <Aspose.PDF.Cpp/PageCollection.h> #include <Aspose.Pdf.Cpp/Facades/facade.h> #include <Aspose.PDF.Cpp/Facades/PdfConverter.h>
So I’m not sure what’s going on here. It looks like a library fetch failure but I’ve included the x64 .lib files & their respecive .dll files #pragma comment(lib, "Aspose.PDF.Cpp_vc14x64.lib") #pragma comment(lib, "Aspose.PDF.Cpp_vc14x64d.lib")
I am trying to get started with asposePDF, but this is setting me back, what do I do? Here’s my PDF → PNG code:
System::SharedPtr<Aspose::Pdf::Facades::PdfConverter> pngConverter = System::MakeObject<Aspose::Pdf::Facades::PdfConverter>();
pngConverter->BindPdf(u"input.pdf");
pngConverter->DoConvert();
System::String prefix = u"output";
System::String suffix = u".png";
int32_t imageCount = 1;
// Initialise SDL without video
SDL_Init(SDL_INIT_EVENTS | SDL_INIT_TIMER);
// Load the PNG image using SDL
SDL_Surface* surface = IMG_Load("output.png");
// Create an SDL window from hParentWnd
SDL_Window* window = SDL_CreateWindowFrom(hEditControl);
// Set SDL window position and size to match the edit control
RECT rect;
GetClientRect(hEditControl, &rect);
SDL_SetWindowPosition(window, rect.left, rect.top);
SDL_SetWindowSize(window, rect.right - rect.left, rect.bottom - rect.top);
// Create SDL renderer for the window
SDL_Renderer* renderer = SDL_CreateRenderer(window, -1, 0);
// Create SDL texture from the surface
SDL_Texture* texture = SDL_CreateTextureFromSurface(renderer, surface);
// Clear renderer
SDL_RenderClear(renderer);
// Render texture on the window
SDL_RenderCopy(renderer, texture, NULL, NULL);
SDL_RenderPresent(renderer);
}
}```