Почему Docx-Preview JS в неправильном отображении файла docx правильно?Javascript

Форум по Javascript
Ответить Пред. темаСлед. тема
Anonymous
 Почему Docx-Preview JS в неправильном отображении файла docx правильно?

Сообщение Anonymous »

Я использую docx-preview.js для визуализации моего файла Laravel Project Docx в компоненте LiveWire. Когда я рендерил страницу, она не разжигает, как и ожидалось. Я прикрепил изображения для ссылки. У меня этот код для рендеринга: < /p>

Код: Выделить всё




JS Code:
document.addEventListener('DOMContentLoaded', function () {
renderDocx()
});
function renderDocx() {
let templateObjectId = @this.templateObjectId;

axios.get(`/template-objects/${templateObjectId}/personalize/preview`, {
responseType: 'arraybuffer'
}).then(response => {
let currentDocument = new Blob([response.data])
if (!currentDocument)
return;

docx.renderAsync(currentDocument, container)
.then((x) => {
renderThumbnails(container, document.querySelector("#document-container"));
console.log(x);
});
});
}

Personalize Preview Route code function:

public static function previewTemplate(TemplateObject $templateObject)
{
abort_if((! $templateObject->temporary_file_path || ! Storage::disk('local')->exists($templateObject->temporary_file_path)), Response::HTTP_NOT_FOUND);

// Get the file path
$path = Storage::disk('local')->path($templateObject->temporary_file_path);

// Serve the file with the headers
return response()->file($path, [
'Content-Type' => mime_content_type($path),
]);
}


Подробнее здесь: https://stackoverflow.com/questions/797 ... e-properly
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Javascript»